Skip to content

Commit

Permalink
Split up in multiple jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm committed Apr 16, 2024
1 parent 1b49482 commit a371a34
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .ci/build-kit/compile.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh

cmake \
-B build \
-B "$EXT_MOUNT/build" \
-S "$EXT_MOUNT/source" \
-G Ninja \
-DEVC_ENABLE_CCACHE=1 \
-DISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES=OFF \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist" \
-DCMAKE_INSTALL_PREFIX="$EXT_MOUNT/dist" \
-DBUILD_TESTING=ON

ninja -j$(nproc) -C build
91 changes: 79 additions & 12 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,29 @@ on:
- cron: '37 13,1 * * *'

jobs:
build:
name: Build, Lint and Test
lint:
name: Lint
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout everest-core
uses: actions/checkout@v3
with:
path: source
- name: Run clang-format
uses: everest/everest-ci/github-actions/[email protected]
with:
source-dir: source
extensions: hpp, cpp
compile:
name: Configure and Compile
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
# LTODO: use github actions outputs or custom github actions
- name: Format branch name for cache key
run: |
BRANCH_NAME_FOR_CACHE="${GITHUB_REF_NAME//-/_}"
echo "branch_name_for_cache=${BRANCH_NAME_FOR_CACHE}" >> "$GITHUB_ENV"
# LTODO: use compile-main ??
- name: Setup cache
uses: actions/cache@v3
with:
Expand All @@ -35,12 +50,6 @@ jobs:
uses: actions/checkout@v3
with:
path: source
- name: Run clang-format
uses: everest/everest-ci/github-actions/[email protected]
with:
source-dir: source
extensions: hpp,cpp
exclude: cache
- name: Setup run scripts
run: |
mkdir scripts
Expand All @@ -55,21 +64,79 @@ jobs:
--volume "$(pwd):/ext" \
--name compile-container \
build-kit run-script compile
- name: Commit compile-container
- name: Upload build directory
uses: actions/upload-artifact@v3
with:
name: build-directory
path: ${{ github.workspace }}/build
- name: Upload dist directory
uses: actions/upload-artifact@v3
with:
name: dist-directory
path: ${{ github.workspace }}/dist
run-unit-tests:
needs:
- compile
name: Run Unit Tests
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Download build directory
uses: actions/download-artifact@v3
with:
name: build-directory
path: ${{ github.workspace }}/build
- name: Download dist directory
uses: actions/download-artifact@v3
with:
name: dist-directory
path: ${{ github.workspace }}/dist
- name: Checkout everest-core
uses: actions/checkout@v3
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/.ci/build-kit/ scripts
- name: Pull build-kit image
run: |
docker commit compile-container build-image
docker pull --quiet ghcr.io/everest/build-kit-alpine:latest
docker image tag ghcr.io/everest/build-kit-alpine:latest build-kit
- name: Run unit tests
run: |
docker run \
--volume "$(pwd):/ext" \
--name unit-tests-container \
build-image run-script run_unit_tests
build-kit run-script run_unit_tests
run-integration-tests:
needs:
- compile
name: Run Integration Tests
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Download dist directory
uses: actions/download-artifact@v3
with:
name: dist-directory
path: ${{ github.workspace }}/dist
- name: Checkout everest-core
uses: actions/checkout@v3
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/.ci/build-kit/ scripts
- name: Pull build-kit image
run: |
docker pull --quiet ghcr.io/everest/build-kit-alpine:latest
docker image tag ghcr.io/everest/build-kit-alpine:latest build-kit
- name: Create integration-image
run: |
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-image run-script prepare_integration_tests
build-kit run-script prepare_integration_tests
docker commit test-container integration-image
- name: Run integration tests
run: |
Expand Down

0 comments on commit a371a34

Please sign in to comment.