From fa5b152c62286d53716495be0b0eafd16797fce6 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 | 6 ++-- .github/workflows/tests.yml | 31 +++++++---------- 3 files changed, 16 insertions(+), 67 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..b39eb9b72 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,13 +11,13 @@ jobs: 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..bbf34712c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,27 +11,22 @@ on: jobs: tests: runs-on: ubuntu-latest + container: + image: python:3.12 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 - 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 + script/test --coverage + - name: Generate coverage xml + run: coverage xml + - name: Upload code coverage run: | less coverage.xml pip install codecov