Merge pull request #406 from snyk/github-workflow-updy2 #1528
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Print hostname | |
| run: hostname | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: pre-commit/action@v3.0.1 | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| AGENT_SCAN_ENVIRONMENT: ci | |
| AGENT_SCAN_CI_HOSTNAME: ${{ secrets.AGENT_SCAN_CI_HOSTNAME }} | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| strategy: | |
| # Run tests and ensure binary can be built for all supported platforms. | |
| # ubuntu-latest: x86_64 | |
| # ubuntu-24.04-arm: ARM64 | |
| # windows-latest: x86_64 | |
| # macos-latest: ARM64 | |
| # macos-15-intel: x86_64 | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest, macos-15-intel] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Print scan environment variables | |
| run: | | |
| echo "AGENT_SCAN_ENVIRONMENT=${{ env.AGENT_SCAN_ENVIRONMENT }}" | |
| echo "AGENT_SCAN_CI_HOSTNAME=${{ env.AGENT_SCAN_CI_HOSTNAME }}" | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Run tests | |
| run: uv run --frozen make ci | |
| - name: Upload binary artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-scan-${{ matrix.os }}-binary | |
| path: dist/agent-scan* | |
| if-no-files-found: error | |
| - name: Build wheel | |
| run: uv run --frozen make build | |
| - name: Upload wheel artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-scan-${{ matrix.os }}.whl | |
| path: dist/*.whl | |
| if-no-files-found: error |