Skip to content

Commit

Permalink
Merge pull request #745 from opensafely-core/fix-ci2
Browse files Browse the repository at this point in the history
Fix CI again
  • Loading branch information
bloodearnest authored Sep 30, 2024
2 parents a4e9cb4 + 1df7f2b commit 9d103de
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
run: docker login https://ghcr.io -u ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:latest
IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME"
docker tag "$IMAGE_NAME" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:latest"
create-release-from-tag:
name: Create release from tag
Expand Down
38 changes: 17 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ jobs:

test-job:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, windows-2019, macos-12]
os: [ubuntu-20.04, ubuntu-22.04, windows-2019, macos-13]
# Python 3.8 is what we currently support for running cohortextractor
# locally, and 3.9 is what we required for databuilder so we need to make
# sure we can run with those
python: ["3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}
name: Run test suite
env:
PYTHON_VERSION: "python${{ matrix.python }}"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -46,30 +49,23 @@ jobs:
cache: "pip"
cache-dependency-path: requirements.*.txt

- name: Set up default Python 3.8 for MacOS
if: ${{ matrix.os == 'macos-12' && matrix.python != '3.8' }}
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: requirements.*.txt

- name: install Docker/Colima on MacOS
if: ${{ matrix.os == 'macos-12' }}
run: brew install docker

- name: start Colima on MacOS
if: ${{ matrix.os == 'macos-12' }}
run: colima start

- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d

- name: Run actual tests on ${{ matrix.os }}
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: just test -vvv
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }}
run: |
echo "$PYTHON_VERSION"
just test -vvv
- name: Run actual tests on ${{ matrix.os }}
if: ${{ matrix.os == 'windows-2019' || matrix.os == 'macos-12' }}
- name: Run actual tests on windows
if: ${{ matrix.os == 'windows-2019' }}
run: |
# windows powershell: set to executable w/o version, as it doesn't have one on windows
$Env:PYTHON_VERSION = "python"
just test-no-docker -vvv
- name: Run actual tests on macos
if: ${{ matrix.os == 'macos-13' }}
run: just test-no-docker -vvv

test-package-build:
Expand Down
1 change: 1 addition & 0 deletions tests/cli/test_kill_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from tests.factories import job_factory


@pytest.mark.needs_docker
@pytest.mark.parametrize("cleanup", [False, True])
def test_kill_job(cleanup, tmp_work_dir, db, monkeypatch):
job = job_factory(state=State.RUNNING, status_code=StatusCode.EXECUTING)
Expand Down
3 changes: 3 additions & 0 deletions tests/cli/test_prepare_for_reboot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from unittest import mock

import pytest

from jobrunner.cli import prepare_for_reboot
from jobrunner.executors import local, volumes
from jobrunner.lib import database, docker
Expand All @@ -8,6 +10,7 @@
from tests.factories import job_factory


@pytest.mark.needs_docker
def test_prepare_for_reboot(db, monkeypatch):
j1 = job_factory(state=State.RUNNING, status_code=StatusCode.EXECUTING)
j2 = job_factory(
Expand Down
1 change: 1 addition & 0 deletions tests/test_local_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ def test_delete_volume(docker_cleanup, job_definition, tmp_work_dir, volume_api)
@pytest.mark.skipif(
sys.platform != "linux" and sys.platform != "darwin", reason="linux/darwin only"
)
@pytest.mark.needs_docker
def test_delete_volume_error_bindmount(
docker_cleanup, job_definition, tmp_work_dir, monkeypatch, caplog
):
Expand Down

0 comments on commit 9d103de

Please sign in to comment.