Skip to content

Commit

Permalink
workflows: Run unit tests in our tasks container
Browse files Browse the repository at this point in the history
This reduces our tools like `ruff` to a single source of truth (as all
our other projects already run their unit tests and linting in the tasks
container). It also removes a lot of moving parts only relevant for CI.
In practice, us developers run the unit tests in toolbox or our own dev
machines anyway.

Move building the guide in the release workflow to the tasks container
as well.
  • Loading branch information
martinpitt committed Feb 13, 2024
1 parent 1d05116 commit 274a919
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
permissions: {}
runs-on: ubuntu-latest
container:
image: ghcr.io/cockpit-project/unit-tests
image: quay.io/cockpit/tasks:latest
options: --user root
steps:
- name: Checkout website repository
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/unit-tests-refresh.yml

This file was deleted.

37 changes: 16 additions & 21 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,34 @@ jobs:
unit-tests:
runs-on: ubuntu-22.04
permissions: {}
container:
image: quay.io/cockpit/tasks:latest
options: --user 1001
strategy:
matrix:
startarg:
- { make: 'check-memory', cc: 'gcc', tag: 'latest' }
- { make: 'distcheck', cc: 'clang', tag: 'latest' }
scenario:
- { make: 'check-memory', cc: 'gcc' }
- { make: 'distcheck', cc: 'clang' }
# this runs static code checks, unlike distcheck
- { make: 'check', cc: 'gcc', tag: 'latest' }
- { make: 'pytest-cov', cc: 'gcc', tag: 'latest' }
- { make: 'check', cc: 'gcc' }
- { make: 'pytest-cov', cc: 'gcc' }
fail-fast: false
timeout-minutes: 60
env:
FORCE_COLOR: 1
TEST_BROWSER: firefox
CFLAGS: '-O2 -gdwarf-4'
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# need this to also fetch tags
fetch-depth: 0
submodules: true

- name: Build unit test container if it changed
run: |
changes=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD -- containers/unit-tests/)
if [ -n "${changes}" ]; then
containers/unit-tests/build
fi
- name: Run unit-tests container
- name: Run unit test
timeout-minutes: 30
# HACK: -gdwarf-4 is for clang: https://bugs.kde.org/show_bug.cgi?id=452758
run: |
containers/unit-tests/start \
--verbose \
--env=FORCE_COLOR=1 \
--env=CC='${{ matrix.startarg.cc }}' \
--env=CFLAGS='-O2 -gdwarf-4' \
--env=EXTRA_DISTCHECK_CONFIGURE_FLAGS='${{ matrix.startarg.distcheck_flags }}' \
--image-tag='${{ matrix.startarg.tag }}' \
--make '${{ matrix.startarg.make }}'
./autogen.sh
make -j$(nproc) CC='${{ matrix.scenario.cc }}' '${{ matrix.scenario.make }}'
26 changes: 0 additions & 26 deletions containers/unit-tests/Dockerfile

This file was deleted.

71 changes: 0 additions & 71 deletions containers/unit-tests/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions containers/unit-tests/build

This file was deleted.

12 changes: 0 additions & 12 deletions containers/unit-tests/entrypoint

This file was deleted.

79 changes: 0 additions & 79 deletions containers/unit-tests/setup.sh

This file was deleted.

Loading

0 comments on commit 274a919

Please sign in to comment.