From 682fcc62382b32a2279890d54cb42dc1c82497ce Mon Sep 17 00:00:00 2001 From: Joaquim d'Souza Date: Fri, 8 Mar 2024 17:11:05 +0100 Subject: [PATCH] fix: github actions --- .github/actions/in-container/action.yml | 46 ------------------------- .github/workflows/lint.yml | 8 ++--- .github/workflows/tests.yml | 33 ++++++++---------- poetry.lock | 2 +- pyproject.toml | 2 ++ 5 files changed, 22 insertions(+), 69 deletions(-) delete mode 100644 .github/actions/in-container/action.yml diff --git a/.github/actions/in-container/action.yml b/.github/actions/in-container/action.yml deleted file mode 100644 index eec1d4544..000000000 --- a/.github/actions/in-container/action.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: 'In container action' -description: 'Runs specified commands inside the specified container.' -inputs: - run: - description: 'Commands to run inside context' - required: true - shell: - description: 'shell to run command on inside docker' - default: 'bash --noprofile --norc -eo pipefail' - app: - description: 'docker-compose app to run command in' - required: true - default: 'web' - use_dev_image: - description: 'Can this use the current dev image or should it rebuild from scratch (still some layer caching benefits)' - default: 'false' - -runs: - using: "composite" - - steps: - - name: Build image from docker-compose - if: ${{ inputs.use_dev_image == 'false' }} - uses: ./.github/actions/cached-build - with: - branch: "master" - push_to_registry: false - - - name: construct docker command - shell: bash - run: | - if [ "$USE_DEV_IMAGE" = "true" ]; then - composeFiles="-f docker-compose.yml -f .devcontainer/docker-compose-extend-cached-image.yml" - else - composeFiles="-f docker-compose.yml" - fi - shellCommands='$@' - echo "docker-compose $composeFiles run --volume /home/runner:/home/runner/ ${{ inputs.app }} ${{ inputs.shell }} $shellCommands" > ${{ github.action_path }}/docker_command.sh - echo "${{ github.action_path }}" >> $GITHUB_PATH - env: - USE_DEV_IMAGE: ${{ inputs.use_dev_image}} - - - name: Run script in docker - shell: bash docker_command.sh {0} - run: | - ${{ inputs.run }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 70d2d13c8..2cfada1fb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,21 +3,21 @@ name: Lint on: + push: pull_request: - workflow_call: jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: black Lint + - name: Run black uses: psf/black@stable with: options: "--check --diff" src: "." version: "22.8.0" - - name: isort Lint + - name: Run isort uses: isort/isort-action@master - - name: flake8 Lint + - name: Run flake8 uses: py-actions/flake8@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b9e55c07..97095dcd5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,27 +11,24 @@ on: jobs: tests: runs-on: ubuntu-latest + container: + image: python:3.12 + env: + POETRY_VIRTUALENVS_CREATE: "false" steps: - - - name: checkout repo content + - name: Checkout repo content uses: actions/checkout@v2 - + - name: Install poetry + run: curl -sSL https://install.python-poetry.org | python3 - + - name: Install dependencies + run: ~/.local/bin/poetry install -vvv - name: Run django tests - uses: ./.github/actions/in-container - with: - use_dev_image: false - run: | - script/bootstrap - script/test --coverage - - # do this inside the docker container otherwise the paths don't work - - name: generate coverage xml - uses: ./.github/actions/in-container - with: - run: coverage xml - - # do this outside the docker container otherwise can't get repo details - - name: upload code coverage + run: | + script/bootstrap + coverage run --source=. --branch manage.py test + - name: Generate coverage xml + run: coverage xml + - name: Upload code coverage run: | less coverage.xml pip install codecov diff --git a/poetry.lock b/poetry.lock index 240aec607..04359cb66 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2017,4 +2017,4 @@ brotli = ["Brotli"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "299d24d3ef3748d557ec1d618b2029a8abe1563dfc11cac6770c07cd894bf442" +content-hash = "b6918f7d2b5c63aa1cc7c2c1a12588e8771c6f57b60b859db7a8396470aa56b0" diff --git a/pyproject.toml b/pyproject.toml index 4cea33d55..9ece64be6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,8 @@ python-benedict = "^0.33.2" gunicorn = "^21.2.0" whitenoise = "^6.6.0" setuptools = "^69.1.1" +# Explicit numpy requirement improves poetry install speed +numpy = "^1.26.4" [tool.poetry.dev-dependencies] django-debug-toolbar = "^3.7.0"