Skip to content

Commit

Permalink
Switch CI provider to GitHub Actions (#2095)
Browse files Browse the repository at this point in the history
With the addition of support for a second base image in #2088, we no
longer have enough CircleCI credits to test both images properly. GitHub
Actions also provides more substantial runners and better caching, which
may reduce the overall running time.

This PR supersedes #2078.
  • Loading branch information
williamjallen authored Mar 28, 2024
1 parent 329f483 commit 8baeee3
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 78 deletions.
73 changes: 0 additions & 73 deletions .circleci/config.yml

This file was deleted.

132 changes: 132 additions & 0 deletions .github/workflows/build-latest-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Publish Images

on:
push:
branches:
- master
workflow_dispatch:

jobs:
latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build standard production image
with:
context: .
push: true
tags: "kitware/cdash:latest"
target: cdash
cache-from: type=gha
cache-to: type=gha,mode=max

latest-ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build UBI production image
with:
context: .
push: true
tags: "kitware/cdash:latest-ubi"
target: cdash
build-args: |
BASE_IMAGE=ubi
cache-from: type=gha
cache-to: type=gha,mode=max

worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build standard worker image
with:
context: .
push: true
tags: "kitware/cdash-worker:latest"
target: cdash-worker
cache-from: type=gha
cache-to: type=gha,mode=max

worker-ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build UBI worker image
with:
context: .
push: true
tags: "kitware/cdash-worker:latest-ubi"
target: cdash-worker
build-args: |
BASE_IMAGE=ubi
cache-from: type=gha
cache-to: type=gha,mode=max

testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build standard development image
with:
context: .
push: true
tags: "kitware/cdash:testing"
target: cdash
build-args: |
DEVELOPMENT_BUILD=1
cache-from: type=gha
cache-to: type=gha,mode=max

testing-ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build UBI development image
with:
context: .
push: true
tags: "kitware/cdash:testing-ubi"
target: cdash
build-args: |
BASE_IMAGE=ubi
DEVELOPMENT_BUILD=1
cache-from: type=gha
cache-to: type=gha,mode=max

68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
tests:
env:
SITENAME: GitHub Actions
BASE_IMAGE: ${{matrix.base-image}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: ['mysql', 'postgres']
base-image: ['debian', 'ubi']
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build images
run: |
docker compose \
-f docker/docker-compose.yml \
-f docker/docker-compose.dev.yml \
-f "docker/docker-compose.${{matrix.database}}.yml" \
--env-file .env.dev up -d \
--build \
--wait
- name: Run Tests
run: |
source .github/workflows/commands.bash
cdash_run_and_submit_${{matrix.database}}_ctest
build-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base-image: [ 'debian', 'ubi' ]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
name: Build ${{matrix.base-image}} production image
with:
context: .
push: false
target: cdash
build-args: |
BASE_IMAGE=${{matrix.base-image}}
cache-from: type=gha
cache-to: type=gha,mode=max
# Building the worker image should be almost instantaneous due to caching of the regular image
- uses: docker/build-push-action@v5
name: Build ${{matrix.base-image}} worker image
with:
context: .
push: false
target: cdash-worker
build-args: |
BASE_IMAGE=${{matrix.base-image}}
cache-from: type=gha
cache-to: type=gha,mode=max
8 changes: 4 additions & 4 deletions .circleci/commands.bash → .github/workflows/commands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ cdash_run_and_submit_ctest() {
local site
local branch

ctest_driver="/cdash/.circleci/ctest_driver_script.cmake"
ctest_driver="/cdash/.github/workflows/ctest_driver_script.cmake"

database="$1" ; shift
postgres="$1" ; shift

site=$(cdash_site)
branch=$(cdash_branch)

docker exec --user www-data cdash bash -c "cd /cdash && /usr/bin/git checkout ."
docker exec cdash bash -c "cd /cdash && /usr/bin/git checkout ."

echo "site=$site"
echo "branch=$branch"
echo "database=$database"
echo "postgres=$postgres"
echo "ctest_driver=$ctest_driver"

docker exec --user www-data cdash bash -c "/usr/bin/ctest -VV -j 2 --schedule-random -DSITENAME=\"${site}\" -DBUILDNAME=\"${branch}_${database}\" -Dpostgres=${postgres} -S ${ctest_driver}"
docker exec cdash bash -c "/usr/bin/ctest -VV -j 4 --schedule-random -DSITENAME=\"${site}\" -DBUILDNAME=\"${branch}_${database}\" -Dpostgres=${postgres} -S ${ctest_driver}"
}

cdash_run_and_submit_mysql_ctest() {
cdash_run_and_submit_ctest MySQL OFF
}

cdash_run_and_submit_pgsql_ctest() {
cdash_run_and_submit_postgres_ctest() {
cdash_run_and_submit_ctest PgSQL ON
}
File renamed without changes.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Release

on:
push:
tags:
- "*"

jobs:
debian:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build ${{ github.ref_name }} image
with:
context: .
push: true
tags: "kitware/cdash:${{ github.ref_name }}"
target: cdash
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: docker/build-push-action@v5
name: Build ${{ github.ref_name }} worker image
with:
context: .
push: true
tags: "kitware/cdash-worker:${{ github.ref_name }}"
target: cdash
cache-from: type=gha
cache-to: type=gha,mode=max

ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
name: Build ${{ github.ref_name }} image
with:
context: .
push: true
tags: "kitware/cdash:${{ github.ref_name }}-ubi"
target: cdash
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: docker/build-push-action@v5
name: Build ${{ github.ref_name }} worker image
with:
context: .
push: true
tags: "kitware/cdash-worker:${{ github.ref_name }}-ubi"
target: cdash
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
environment:
DB_HOST: database
healthcheck:
test: ps aux | grep apache2 | grep -v grep > /dev/null
test: curl -s -o /dev/null -w "%{http_code}" http://cdash:8080/ping | grep 200 > /dev/null
interval: 5s
timeout: 10s
retries: 20
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ add_test(
COMMAND ${CMAKE_SOURCE_DIR}/vendor/bin/phpstan analyse --memory-limit=2G
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
set_tests_properties(php_static_analysis PROPERTIES
# Disable PHPStan on the UBI image since lcobucci/jwt gets removed
DISABLED "$<STREQUAL:${CDASH_IMAGE},ubi>"
)

# Run the JS linter
add_test(
Expand Down

0 comments on commit 8baeee3

Please sign in to comment.