diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23881b0..ba84f17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,9 +4,11 @@ on: pull_request: branches: [main] workflow_dispatch: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: build: name: build (${{ matrix.python-version }}) @@ -14,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.11", "3.12" ] + python-version: ["3.11","3.12"] steps: - name: Checkout @@ -50,18 +52,17 @@ jobs: - name: Package & smoke-test CLI run: | - set -euxo pipefail poetry build poetry run python -m pip install . - poetry run python -c "import sys, diff_risk_dashboard as m; print(sys.version); print(getattr(m, \"__version__\", \"0.0.0\"))" + poetry run python -c "import sys, diff_risk_dashboard as m; print(sys.version); print(getattr(m, '__version__', '0.0.0'))" rm -rf _intel && mkdir -p _intel poetry run python -m diff_risk_dashboard.cli examples/sample_apv.json -f md -o _intel/report.md ls -l _intel/report.md && head -n 5 _intel/report.md + - name: Upload sample report - if: matrix.python-version == '3.12' - if: matrix.python-version == '3.12' - if: always() + if: ${{ matrix.python-version == '3.12' }} uses: actions/upload-artifact@v4 with: name: sample-report path: _intel/report.md + if-no-files-found: error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7b74a7..df9d692 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,21 +3,45 @@ on: pull_request: push: branches: [ main ] + jobs: python: name: python (${{ matrix.python-version }}) runs-on: ubuntu-latest strategy: - matrix: { python-version: ["3.11","3.12"] } + fail-fast: false + matrix: + python-version: ["3.11","3.12"] + steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v5 - with: { python-version: ${{ matrix.python-version }} } - - run: python -m pip install -U pip - - run: pip install pytest mypy ruff black - - run: ruff check . - - run: black --check . - - run: pytest -q + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: python -m pip install -U pip + + - name: Install tools + + - name: Install project + run: pip install -e . + run: pip install pytest mypy ruff black + + - name: Ruff + run: ruff check . + + - name: Black (check) + run: black --check . + + - name: Pytest + env: + PYTHONPATH: src + run: pytest -q + - name: mypy (solo 3.12) - if: matrix.python-version == '3.12' + if: ${{ matrix.python-version == '3.12' }} run: mypy src