Skip to content

Commit

Permalink
Merge pull request #6 from flamingbear/mhs/DAS-2267/implement-GitHub-…
Browse files Browse the repository at this point in the history
…actions-ci

DAS-2267: Add CI config for testing and reporting.
  • Loading branch information
flamingbear authored Nov 27, 2024
2 parents 3b136ef + 9ab5d41 commit 13e227b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/run_lib_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will run the appropriate library tests across a python matrix of versions.
name: Run Python library tests

on:
workflow_call

jobs:
build_and_test_lib:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']

steps:
- name: Checkout smap-l2-gridder repository
uses: actions/checkout@v4
with:
lfs: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r pip_requirements.txt -r tests/pip_test_requirements.txt
- name: Run science tests while excluding the service tests.
run: |
pytest tests --ignore tests/test_service
37 changes: 37 additions & 0 deletions .github/workflows/run_service_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will build the service and test Docker images for smap-l2-gridder,
# then run the `pytest` suite within a test Docker container, reporting
# test results and code coverage as artefacts. It will be called by the
# workflow that run tests against new PRs and as a first step in the workflow
# that publishes new Docker images.

name: Run Python Service Tests

on:
workflow_call

jobs:
build_and_test_service:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout smap-l2-gridder repository
uses: actions/checkout@v4
with:
lfs: true

- name: Build service image
run: ./bin/build-image

- name: Build test image
run: ./bin/build-test

- name: Run test image
run: ./bin/run-test

- name: Archive test results and coverage
uses: actions/upload-artifact@v4
with:
name: reports
path: reports/**/*
6 changes: 6 additions & 0 deletions .github/workflows/run_tests_on_pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ on:
workflow_dispatch:

jobs:
build_and_test_service:
uses: ./.github/workflows/run_service_tests.yml

run_lib_tests:
uses: ./.github/workflows/run_lib_tests.yml

mypy:
uses: ./.github/workflows/mypy.yml

0 comments on commit 13e227b

Please sign in to comment.