Skip to content

chore(deps): bump codecov/codecov-action from 4 to 5 #2837

chore(deps): bump codecov/codecov-action from 4 to 5

chore(deps): bump codecov/codecov-action from 4 to 5 #2837

Workflow file for this run

name: Test and Publish
on:
push:
pull_request:
branches:
# Branches from forks have the form 'user:branch-name' so we only run
# this job on pull_request events for branches that look like fork
# branches. Without this we would end up running this job twice for non
# forked PRs, once for the push and then once for opening the PR.
- "**:**"
workflow_dispatch:
release:
types: [published]
permissions:
contents: read
pages: write
id-token: write
packages: write
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: harmon758/postgresql-action@v1
with:
postgresql version: "13"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install and configure Poetry
run: python -m pip install -U pip && pip install poetry
- name: Install Dependencies
run: poetry install
- name: Run Tox
run: poetry run tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
publish:
name: Publish container image
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/renalreg/ukrdc-fastapi
tags: |
# workflow dispatch tag by branch
type=ref,event=branch
type=ref,event=pr
# tag semver releases
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# tag all builds with edge, including pre-release releases
type=raw,value=edge
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
build-args: |
GITHUB_SHA=${{ github.sha }}
GITHUB_REF=${{ github.ref }}
SENTRY_DSN=${{ secrets.SENTRY_DSN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
environment: ${{github.event.inputs.deployment_env}}
build-spec:
name: Build OpenAPI spec
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install Dependencies
run: poetry install
- name: Generate API Spec
run: poetry run python clients/generate_spec.py
- name: Store API specification
uses: actions/upload-artifact@v4
with:
name: openapi-spec
path: clients/openapi.json
build-redoc:
name: Build Redoc documentation
runs-on: ubuntu-latest
needs: build-spec
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download OpenAPI spec
uses: actions/download-artifact@v4
with:
name: openapi-spec
path: clients/
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20"
check-latest: true
registry-url: "https://registry.npmjs.org"
- name: Build Redoc documentation
run: npx redoc-cli build clients/openapi.json --output docs/redoc/index.html
- name: Store Redoc documentation
uses: actions/upload-artifact@v4
with:
name: redoc-docs
path: docs/redoc
build-axios-client:
name: Build Axios client and documentation
runs-on: ubuntu-latest
needs: build-spec
env:
SNAPSHOT: ${{ github.event_name != 'release' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download OpenAPI spec
uses: actions/download-artifact@v4
with:
name: openapi-spec
path: clients/
- name: Generate Axios Client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator-tag: v6.6.0
generator: typescript-axios
config-file: clients/typescript-axios-client/config.json
openapi-file: clients/openapi.json
command-args: --additional-properties=snapshot=${SNAPSHOT}
- name: Store typescript-axios-client
uses: actions/upload-artifact@v4
with:
name: typescript-axios-client
path: typescript-axios-client
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20"
check-latest: true
registry-url: "https://registry.npmjs.org"
- name: Install Axios Client
working-directory: typescript-axios-client
run: npm install
- name: Publish Axios client
# Only publish API client on release
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
working-directory: typescript-axios-client
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build client documentation
working-directory: typescript-axios-client
run: npx typedoc ./index.ts --out ../docs/typescript-axios-client
- name: Store typescript-axios-client documentation
uses: actions/upload-artifact@v4
with:
name: typescript-axios-client-docs
path: docs/typescript-axios-client
publish-docs:
name: Publish API and client documentation
runs-on: ubuntu-latest
needs: [build-spec, build-redoc, build-axios-client]
# Only publish API documentation on release
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
concurrency:
group: "pages"
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download OpenAPI spec
uses: actions/download-artifact@v4
with:
name: openapi-spec
path: docs/
- name: Download Redoc documentation
uses: actions/download-artifact@v4
with:
name: redoc-docs
path: docs/redoc/
- name: Download typescript-axios-client documentation
uses: actions/download-artifact@v4
with:
name: typescript-axios-client-docs
path: docs/typescript-axios-client/
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs
- name: Deploy to GitHub Pages
id: deployment # Required to set environment url
uses: actions/deploy-pages@v4
# Only deploy to pages if the workflow was triggered by a stable release
if: (github.event_name == 'release' && !github.event.release.prerelease)