Setup parcels #93
Workflow file for this run
This file contains 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: Continuous integration | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
actionlint: | |
name: Lint GitHub Actions workflows | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check workflow files | |
run: | | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
./actionlint -color | |
shell: bash | |
ruff-check: | |
name: Ruff lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
permissions: | |
contents: read | |
actions: read | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare environment | |
uses: ./.github/actions/prepare-python-environment | |
- name: Lint using ruff | |
run: poetry run ruff check src --output-format sarif --output-file ruff-results.sarif --target-version py312 | |
continue-on-error: true | |
- name: Upload ESLint analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: ruff-results.sarif | |
wait-for-processing: true | |
category: ruff | |
validate-api-docker-build: | |
name: Validate if docker image builds | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build & tag docker image | |
uses: AplinkosMinisterija/reusable-workflows/.github/actions/docker-build-tag-push@main | |
with: | |
environment: test | |
file: Dockerfile | |
push: false | |
generate-redoc: | |
name: Generate ReDoc | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Prepare environment | |
uses: ./.github/actions/prepare-python-environment | |
- name: Generate openapi.json | |
run: poetry run python src/extract-openapi.py src.main:app --out openapi.json | |
- name: Generate openapi.yaml | |
run: poetry run python src/extract-openapi.py src.main:app --out openapi.yaml | |
- name: Generate ReDoc html | |
run: npx @redocly/cli build-docs openapi.yaml --theme.openapi.jsonSampleExpandLevel all | |
- name: Upload openapi.yaml artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openapi.yaml | |
path: openapi.yaml | |
if-no-files-found: error | |
- name: Upload openapi.json artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openapi.json | |
path: openapi.json | |
if-no-files-found: error | |
- name: Upload redoc-static.html artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: redoc-static.html | |
path: redoc-static.html | |
if-no-files-found: error | |
- name: Create dist folder with files | |
run: | | |
mkdir dist | |
cp redoc-static.html dist/index.html | |
cp openapi.yaml openapi.json dist | |
- name: Upload to Cloudflare pages | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy dist --project-name=national-boundaries-api --commit-dirty=true |