| name: ci |
| |
| on: [push, pull_request] |
| |
| jobs: |
| fmt_lint: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v2 |
| - run: npm i |
| - run: npm run format:check |
| - run: npm run lint |
| postgres: |
| runs-on: ubuntu-latest |
| |
| services: |
| postgres: |
| image: postgres |
| ports: |
| - 5432:5432 |
| env: |
| POSTGRES_PASSWORD: postgres |
| options: >- |
| --health-cmd pg_isready |
| --health-interval 10s |
| --health-timeout 5s |
| --health-retries 5 |
| |
| steps: |
| - uses: actions/checkout@v2 |
| - run: npm i |
| - run: npm test -t pg-adapter |
| mysql_and_mysql2: |
| runs-on: ubuntu-latest |
| |
| services: |
| mysql: |
| image: bitnami/mysql |
| ports: |
| - 3306:3306 |
| env: |
| MYSQL_DATABASE: casbin |
| MYSQL_ROOT_PASSWORD: password |
| MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password |
| options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| |
| steps: |
| - uses: actions/checkout@v2 |
| - run: npm i |
| - run: | |
| npm test -t mysql-adapter |
| npm test -t mysql2-adapter |
| |
| sqlite3: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v2 |
| - run: npm i |
| - run: npm test -t sqlite3-adapter |
| |
| finish: |
| needs: [fmt_lint, postgres, mysql_and_mysql2, sqlite3] |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v2 |
| - run: npm i |
| - run: npm run build |
| - name: Release |
| if: github.event_name == 'push' && github.repository == 'node-casbin/basic-adapter' |
| run: npx semantic-release |
| env: |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |