|
| 1 | +name: Build |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + workflow_dispatch: |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: test (${{ matrix.os }}, node-${{ matrix.node }} |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + os: [windows-latest, ubuntu-latest, macos-latest] |
| 18 | + node: [18.x] |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + - name: Use Node.js |
| 26 | + uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: ${{ matrix.config.node }} |
| 29 | + - name: Use Python |
| 30 | + uses: actions/setup-python@v4 |
| 31 | + with: |
| 32 | + python-version: '3.x' |
| 33 | + - name: Restore CLI Binaries |
| 34 | + uses: actions/cache/restore@v3 |
| 35 | + with: |
| 36 | + path: test-resources/cli-releases |
| 37 | + key: ${{ runner.os }}-cli-context-${{ hashFiles('src/test/cliContext.json') }} |
| 38 | + - name: Restore `directories.data` folder (CLI) |
| 39 | + uses: actions/cache/restore@v3 |
| 40 | + with: |
| 41 | + path: test-resources/envs/cli |
| 42 | + key: ${{ runner.os }}-cli-env-${{ hashFiles('src/test/envs.cli.json') }} |
| 43 | + - name: Restore `directories.data` folder (Git) |
| 44 | + uses: actions/cache/restore@v3 |
| 45 | + with: |
| 46 | + path: test-resources/envs/git |
| 47 | + key: ${{ runner.os }}-git-env-${{ hashFiles('src/test/envs.git.json') }} |
| 48 | + - name: Install Dependencies |
| 49 | + run: npm ci |
| 50 | + - name: Check Format |
| 51 | + run: npm run format && git diff --exit-code |
| 52 | + - name: Test |
| 53 | + uses: coactions/setup-xvfb@v1 |
| 54 | + with: |
| 55 | + run: npm run test-all |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + - name: Store CLI Binaries |
| 59 | + uses: actions/cache/save@v3 |
| 60 | + with: |
| 61 | + path: test-resources/cli-releases |
| 62 | + key: ${{ runner.os }}-cli-context-${{ hashFiles('src/test/cliContext.json') }} |
| 63 | + - name: Store `directories.data` folder (CLI) |
| 64 | + uses: actions/cache/save@v3 |
| 65 | + with: |
| 66 | + path: test-resources/envs/cli |
| 67 | + key: ${{ runner.os }}-cli-env-${{ hashFiles('src/test/envs.cli.json') }} |
| 68 | + - name: Store `directories.data` folder (Git) |
| 69 | + uses: actions/cache/save@v3 |
| 70 | + with: |
| 71 | + path: test-resources/envs/git |
| 72 | + key: ${{ runner.os }}-git-env-${{ hashFiles('src/test/envs.git.json') }} |
| 73 | + |
| 74 | + release: |
| 75 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 76 | + runs-on: ubuntu-latest |
| 77 | + needs: [build] |
| 78 | + steps: |
| 79 | + - name: Checkout |
| 80 | + uses: actions/checkout@v3 |
| 81 | + with: |
| 82 | + persist-credentials: false |
| 83 | + - name: Use Node.js |
| 84 | + uses: actions/setup-node@v1 |
| 85 | + with: |
| 86 | + node-version: 18.x |
| 87 | + - name: Install Dependencies |
| 88 | + run: npm ci |
| 89 | + - name: Build |
| 90 | + run: npm run build |
| 91 | + - name: Release |
| 92 | + id: release |
| 93 | + run: npm run release |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }} |
| 96 | + OVSX_PAT: ${{ secrets.OVSX_PAT }} |
| 97 | + outputs: |
| 98 | + release_version: ${{ steps.release.outputs.release_version }} |
0 commit comments