|
| 1 | +name: "Copilot Setup Steps" |
| 2 | + |
| 3 | +# Automatically run the setup steps when they are changed to allow for easy validation, and |
| 4 | +# allow manual testing through the repository's "Actions" tab |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - .github/workflows/copilot-setup-steps.yml |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - .github/workflows/copilot-setup-steps.yml |
| 13 | + |
| 14 | +env: |
| 15 | + NODE_VERSION: 22.15.1 |
| 16 | + NPM_VERSION: 10.9.2 |
| 17 | + PYTHON_VERSION: 3.12 |
| 18 | + DENO_VERSION: '~1.37' |
| 19 | + MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already. |
| 20 | + CACHE_NPM_DEPS: cache-npm |
| 21 | + CACHE_OUT_DIRECTORY: cache-out-directory |
| 22 | + CACHE_PIP_DEPS: cache-pip |
| 23 | + |
| 24 | +jobs: |
| 25 | + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. |
| 26 | + copilot-setup-steps: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + # Set the permissions to the lowest permissions possible needed for your steps. |
| 30 | + # Copilot will be given its own token for its operations. |
| 31 | + permissions: |
| 32 | + # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. |
| 33 | + contents: read |
| 34 | + |
| 35 | + # You can define any steps you want, and they will run before the agent starts. |
| 36 | + # If you do not check out your code, Copilot will do this for you. |
| 37 | + steps: |
| 38 | + - name: Checkout code |
| 39 | + uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Use Node ${{env.NODE_VERSION}} |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: ${{env.NODE_VERSION}} |
| 45 | + |
| 46 | + - name: Use Npm ${{env.NPM_VERSION}} |
| 47 | + run: npm i -g npm@${{env.NPM_VERSION}} |
| 48 | + |
| 49 | + - name: Cache npm files |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ~/.npm |
| 53 | + key: ${{runner.os}}-${{env.CACHE_NPM_DEPS}}-${{hashFiles('package-lock.json')}} |
| 54 | + |
| 55 | + - name: Cache the out/ directory |
| 56 | + uses: actions/cache@v4 |
| 57 | + with: |
| 58 | + path: ./out |
| 59 | + key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}} |
| 60 | + |
| 61 | + # This is faster than running `npm ci`, we do not want to build zmq, etc. |
| 62 | + # Let that happen in other jobs, this job needs to be fast |
| 63 | + - name: npm ci |
| 64 | + run: npm ci --ignore-scripts --prefer-offline --no-audit |
| 65 | + |
| 66 | + - name: npm run postinstall |
| 67 | + run: npm run postinstall |
0 commit comments