Riallinea project-template al nuovo assetto organizzativo di DataCivicLab
#4
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| run_smoke: | |
| description: "Run optional smoke e2e job" | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| PYTHON_VERSION: "3.11" | |
| TOOLKIT_PIP_PACKAGE: "" | |
| TOOLKIT_BIN: "toolkit" | |
| jobs: | |
| contract: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install contract test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install pytest pyyaml | |
| - name: Verify required files | |
| run: | | |
| test -f dataset.yml | |
| test -f sql/clean.sql | |
| test -f scripts/smoke.sh | |
| - name: Run contract tests | |
| run: pytest tests/test_contract.py | |
| smoke: | |
| if: ${{ vars.RUN_SMOKE == '1' || (github.event_name == 'workflow_dispatch' && inputs.run_smoke) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install smoke dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install pytest pyyaml | |
| if [ -n "${TOOLKIT_PIP_PACKAGE}" ]; then | |
| python -m pip install "${TOOLKIT_PIP_PACKAGE}" | |
| else | |
| git clone --depth 1 https://github.com/dataciviclab/toolkit.git .toolkit-src | |
| python -m pip install -e ./.toolkit-src | |
| fi | |
| - name: Export DCL_ROOT | |
| run: echo "DCL_ROOT=${GITHUB_WORKSPACE}" >> "${GITHUB_ENV}" | |
| - name: Smoke run all validate all status | |
| run: sh scripts/smoke.sh | |
| - name: Upload minimal artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: toolkit-artifacts | |
| path: | | |
| _smoke_out/data/_runs/**/*.json | |
| _smoke_out/data/raw/**/*.json | |
| _smoke_out/data/clean/**/*.json | |
| _smoke_out/data/mart/**/*.json | |
| if-no-files-found: warn |