feat: improve CI workflow and README badges #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: [push, pull_request] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2.1.5 | |
| - name: Install Dependency | |
| run: yarn install | |
| - name: Run Lint | |
| run: yarn run lint | |
| - name: Run Format Check | |
| run: yarn run format:check | |
| coverage: | |
| needs: [lint] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Setup MySQL | |
| uses: mirromutth/mysql-action@v1.1 | |
| with: | |
| mysql database: casbin | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2.1.5 | |
| with: | |
| node-version: 20 | |
| - name: Install Dependency | |
| run: yarn install | |
| - name: Run Coverage | |
| run: yarn run jest --coverage --forceExit | |
| - name: Coveralls | |
| uses: coverallsapp/github-action@master | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel: true | |
| test: | |
| needs: [lint] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| node: ['18', '20'] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Setup MySQL | |
| uses: mirromutth/mysql-action@v1.1 | |
| with: | |
| mysql database: casbin | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install Dependency | |
| run: yarn install | |
| - name: Run Unit test | |
| run: yarn run test | |
| semantic-release: | |
| needs: [lint, test, coverage] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: Run semantic-release | |
| if: github.repository == 'node-casbin/sequelize-adapter' && github.event_name == 'push' | |
| run: | | |
| yarn install | |
| yarn run prepack | |
| yarn run release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |