Skip to content

Commit

Permalink
Add functional test to github workflows
Browse files Browse the repository at this point in the history
Also, update default os to 22.04
  • Loading branch information
bloodearnest committed Sep 27, 2024
1 parent 5eebfcf commit 008f3e1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:

jobs:
tag-new-version:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.tag.outputs.new_tag }}
version: ${{ steps.tag.outputs.new_version }}
Expand Down Expand Up @@ -51,13 +51,15 @@ jobs:
just docker/build prod # explicitly build prod as well
- name: Test image
run: just docker/test
- name: Functional teste
run: just docker/functional-test
- name: Log into GitHub Container Registry
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: 27 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
check:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand All @@ -26,13 +26,15 @@ jobs:
test-job:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, windows-2019, macos-12]
os: [ubuntu-22.04, windows-2019, macos-12]
# 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 Down Expand Up @@ -64,16 +66,27 @@ jobs:

- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d

- name: Run actual tests on ${{ matrix.os }}
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: just test -vvv
- name: Run actual tests on linux
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
echo "$PYTHON_VERSION"
just test -vvv
- name: Run actual tests on windows
if: ${{ matrix.os == 'windows-2019' }}
run: |
# version is not in name, just use the default
set PYTHON_VERSION=python
just test-no-docker -vvv
- name: Run actual tests on ${{ matrix.os }}
if: ${{ matrix.os == 'windows-2019' || matrix.os == 'macos-12' }}
run: just test-no-docker -vvv
- name: Run actual tests on macos
if: ${{ matrix.os == 'macos-12' }}
run: |
echo "$PYTHON_VERSION"
just test-no-docker -vvv
test-package-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Test we can build PyPI package
steps:
- name: Checkout
Expand All @@ -100,7 +113,7 @@ jobs:
run: just package-test sdist

test-docker:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Test docker image
steps:
- name: Checkout
Expand All @@ -117,8 +130,11 @@ jobs:
- name: Run tests in docker-image
run: just docker/test

- name: Run functional test
run: just docker/functional-test

test-github-workflow-output:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Inspect test runner output in the context of a Github Workflow
steps:
- name: Checkout
Expand Down

0 comments on commit 008f3e1

Please sign in to comment.