| name: CI |
| |
| on: [push, pull_request] |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| lint: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v2 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v3 |
| with: |
| node-version: ^20 |
| |
| - name: Install Dependency |
| run: yarn install --frozen-lockfile |
| |
| - name: Run Lint |
| run: yarn run lint |
| |
| coverage: |
| needs: [lint] |
| runs-on: ubuntu-latest |
| services: |
| redis: |
| image: redis |
| options: >- |
| --health-cmd "redis-cli ping" |
| --health-interval 10s |
| --health-timeout 5s |
| --health-retries 5 |
| ports: |
| - 6379:6379 |
| redis-cluster: |
| image: grokzen/redis-cluster:6.2.0 |
| ports: |
| - 7000:7000 |
| - 7001:7001 |
| - 7002:7002 |
| - 7003:7003 |
| - 7004:7004 |
| - 7005:7005 |
| steps: |
| - uses: actions/checkout@v2 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v3 |
| with: |
| node-version: ^20 |
| |
| - name: Install Dependency |
| run: yarn install --frozen-lockfile |
| |
| - name: Run Coverage |
| run: yarn run coverage |
| |
| - name: Coveralls |
| uses: coverallsapp/github-action@master |
| with: |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| |
| test: |
| needs: [lint] |
| runs-on: ubuntu-latest |
| strategy: |
| fail-fast: false |
| matrix: |
| node-version: [^20] |
| services: |
| redis: |
| image: redis |
| options: >- |
| --health-cmd "redis-cli ping" |
| --health-interval 10s |
| --health-timeout 5s |
| --health-retries 5 |
| ports: |
| - 6379:6379 |
| redis-cluster: |
| image: grokzen/redis-cluster:6.2.0 |
| ports: |
| - 7000:7000 |
| - 7001:7001 |
| - 7002:7002 |
| - 7003:7003 |
| - 7004:7004 |
| - 7005:7005 |
| steps: |
| - uses: actions/checkout@v2 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v3 |
| with: |
| node-version: ${{ matrix.node-version }} |
| |
| - name: Install Dependency |
| run: yarn install --frozen-lockfile |
| |
| - 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/redis-watcher' && github.event_name == 'push' |
| run: | |
| yarn install --frozen-lockfile |
| yarn run build |
| yarn run release |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |