|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [ push, pull_request ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + lint: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + |
| 11 | + - name: Set up Node.js |
| 12 | + |
| 13 | + |
| 14 | + - name: Install Dependency |
| 15 | + run: yarn install |
| 16 | + |
| 17 | + - name: Run Lint |
| 18 | + run: yarn run lint |
| 19 | + |
| 20 | + - name: Run Fix |
| 21 | + run: yarn run fix |
| 22 | + |
| 23 | + coverage: |
| 24 | + needs: [ lint ] |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Setup MySQL |
| 30 | + uses: mirromutth/[email protected] |
| 31 | + with: |
| 32 | + mysql database: casbin |
| 33 | + mysql root password: password |
| 34 | + |
| 35 | + - name: Set up Node.js |
| 36 | + |
| 37 | + with: |
| 38 | + node-version: ^14 |
| 39 | + |
| 40 | + - name: Install Dependency |
| 41 | + run: yarn install |
| 42 | + |
| 43 | + - name: Run Coverage |
| 44 | + run: yarn run coverage |
| 45 | + |
| 46 | + - name: Coveralls |
| 47 | + uses: coverallsapp/github-action@master |
| 48 | + with: |
| 49 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + parallel: true |
| 51 | + |
| 52 | + test: |
| 53 | + needs: [ lint ] |
| 54 | + runs-on: ubuntu-latest |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + node: [ ^12, ^13, ^14, ^15 ] |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + |
| 61 | + - name: Setup MySQL |
| 62 | + uses: mirromutth/[email protected] |
| 63 | + with: |
| 64 | + mysql database: casbin |
| 65 | + mysql root password: password |
| 66 | + |
| 67 | + - name: Set up Node.js |
| 68 | + |
| 69 | + with: |
| 70 | + node-version: ${{ matrix.node }} |
| 71 | + |
| 72 | + - name: Install Dependency |
| 73 | + run: yarn install |
| 74 | + |
| 75 | + - name: Run Unit test |
| 76 | + run: yarn run test |
| 77 | + |
| 78 | + semantic-release: |
| 79 | + needs: [ lint,test,coverage ] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + |
| 84 | + - name: Run semantic-release |
| 85 | + if: github.repository == 'node-casbin/typeorm-adapter' && github.event_name == 'push' |
| 86 | + run: | |
| 87 | + yarn install --no-lockfile |
| 88 | + yarn run prepublish |
| 89 | + yarn run release |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments