Misc: Pip lock (#134) #363
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
| # This is a basic workflow to help you get started with Actions | |
| name: CI | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the main branch | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| linter: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11] | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install project for developers | |
| run: make install-dev | |
| - name: Run linter | |
| run: make lint | |
| lock-check: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11] | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install pip-tools | |
| run: pip install pip-tools | |
| - name: Check lock files are in sync | |
| run: | | |
| make lock | |
| git diff --exit-code requirements.txt requirements-dev.txt || \ | |
| (echo "Lock files are out of sync with pyproject.toml. Run 'make lock' and commit." && exit 1) | |
| license-check: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11] | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Run license-check | |
| run: make license-check | |
| doc: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11] | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install project for developers | |
| run: make install-dev | |
| - name: Run Sphinx doc generation | |
| run: make doc-sphinx | |
| tests_linux: | |
| needs: linter | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11] | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install project for developers | |
| run: make install-dev | |
| - name: Run tests | |
| id: unit-test | |
| run: pytest -v --cov-config=.coveragerc --cov=nx_neptune -l --tb=short --maxfail=1 --cov-fail-under=80 tests/ | |
| - name: Package test reports | |
| run: coverage xml && coverage html | |
| if: always() | |
| - name: Upload HTML coverage report | |
| id: artifact-upload-step | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: htmlcov/ | |
| - name: Comment PR with artifact link | |
| if: ${{ failure() && steps.unit-test.outcome == 'failure' && github.event_name == 'pull_request'}} | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const artifactId = ${{ steps.artifact-upload-step.outputs.artifact-id }} | |
| const prNumber = context.payload.pull_request.number; | |
| const runId = context.runId; | |
| const artifactUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}/artifacts/${artifactId}`; | |
| github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: `📊 **Coverage Report**: Download the HTML report [here](${artifactUrl}).` | |
| }); |