Skip to content

Bump flask from 1.1.4 to 3.0 in /src/web #107

Bump flask from 1.1.4 to 3.0 in /src/web

Bump flask from 1.1.4 to 3.0 in /src/web #107

Workflow file for this run

name: CICD
on:
push:
branches:
- main
pull_request:
branches:
- "**"
workflow_dispatch:
inputs:
rewrite_dependencies:
description:
If "true" or empty CICD will rewrite BL_Python dependencies,\n
during the build only, to use the local filesystem checkout rather than PyPI.\n
If "false" CICD will not rewrite the BL_Python dependencies.
type: choice
options:
- true
- false
default: "true"
required: true
jobs:
Checkout:
name: Checkout and Setup
runs-on: ubuntu-latest
outputs:
repository-build-cache-key: ${{ steps.repository-build-cache-key.outputs.cache_key }}
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- id: repository-build-cache-key
run: |
cache_key='${{ runner.os }}-${{ github.event_name != 'workflow_dispatch' || github.run_attempt }}-${{ hashFiles('pyproject.toml', 'src/*/pyproject.toml') }}'
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Cache repository build
id: repository-build-cache
with:
path: ${{ github.workspace }}
# Use the same cache between Workflow runs _except_ when the event is a workflow_dispatch.
# This should result in cache keys like "Linux-true-abc123" for all runs _except_ workflow_dispatch,
# and cache keys like "linux-123-abc123" for workflow_dispatch.
key: ${{ steps.repository-build-cache-key.outputs.cache_key }}
- name: Set up Python ${{ matrix.python-version }}
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
uses: actions/setup-python@v4
id: install_python
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Create Venv
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
run: |
${{ steps.install_python.outputs.python-path }} -m venv .github-venv
- name: Install dependencies
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
run: |
echo Setting up dependencies
python -m pip install -U pip
python -m pip install toml
REWRITE_DEPENDENCIES=${{ inputs.rewrite_dependencies }} \
./.github/workflows/CICD-scripts/pyproject_dependency_rewrite.py
source .github-venv/bin/activate
./install_all.sh -e
Pyright:
name: Static type checking
runs-on: ubuntu-latest
needs:
- Checkout
if: ${{( always() && !cancelled() ) }}
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true
- name: Test with pyright
run: |
echo Running pyright
source .github-venv/bin/activate
pyright
Pytest:
name: Automated testing
runs-on: ubuntu-latest
needs:
- Checkout
if: ${{( always() && !cancelled() ) }}
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true
- name: Test with pytest and generate reports
run: |
echo Running pytest
source .github-venv/bin/activate
pytest -k "not acceptance"
coverage html
- name: Output pytest report
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: pytest-and-coverage-report
path: |
pytest.xml
cov.xml
.coverage
htmlcov/
retention-days: 1
if-no-files-found: error
Style:
name: Style and formatting
runs-on: ubuntu-latest
needs:
- Checkout
if: ${{( always() && !cancelled() ) }}
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true
- name: Check code style
run: |
source .github-venv/bin/activate
black --check src
- name: Check import order
run: |
source .github-venv/bin/activate
isort --check-only src
Final-status-check:
name: Check workflow success
runs-on: ubuntu-latest
needs:
- Checkout
- Pyright
- Pytest
- Style
# this job should run regardless of success, failure, or skips,
# but not if the workflow is canceled. `always()` ignores canceled,
# and so we check for the canceled state.
if: ${{( always() && !cancelled() ) }}
steps:
- name: Failure
# once the "needs" jobs have completed, if any of them
# failed, then the entire workflow is considered failed.
if: |
contains(toJSON(needs), '"result": "failure"')
env:
RANDOM_EOF: |
EOF`echo $RANDOM | base64`
run: |
echo One or more required jobs did not complete successfully;
jq -r 'keys[] as $job | "Job ID: \($job)'"\n"' \(.[$job] | .result)"' <<${{ env.RANDOM_EOF }}
${{ toJSON(needs) }}
${{ env.RANDOM_EOF }}
exit 1;
# TODO consider uploading the repository so errors
# can be more easily resolved.
#- name: Upload repository build
# uses: actions/upload-artifact@v3
# with:
# name: repository-build
# path: ${{ github.workspace }}
# retention-days: 1
# if-no-files-found: error
- name: Success
run: echo Workflow succeeded; exit 0;