data: add missing postal codes from monitor (#43) #90
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] | |
| paths-ignore: | |
| - '**.md' | |
| - '**.csv' | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| - '**.csv' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install ruff | |
| - run: ruff check app/ scripts/ | |
| - run: ruff format --check app/ scripts/ | |
| import-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -r requirements.txt | |
| - run: python -c "from app.main import app; print('imports OK')" | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -r requirements.txt | |
| - name: Dependency audit | |
| run: pip install pip-audit && pip-audit -r requirements.lock | |
| - name: Static security analysis | |
| run: pip install bandit && bandit -r app/ -c pyproject.toml | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -r requirements-dev.txt | |
| - run: pytest tests/ -v | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build image | |
| run: docker build -t postalcode2nuts . | |
| - name: Verify non-root user | |
| run: | | |
| user=$(docker run --rm postalcode2nuts whoami) | |
| echo "Container user: $user" | |
| [ "$user" = "appuser" ] || exit 1 | |
| publish: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: [lint, import-check, test, security, docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v6 | |
| id: meta | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha | |
| - uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |