Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Split up in multiple jobs #633

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .ci/build-kit/compile.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/sh

set -e

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
ninja -j$(nproc) -C "$EXT_MOUNT/build"
ninja -j$(nproc) -C "$EXT_MOUNT/build" install
7 changes: 3 additions & 4 deletions .ci/build-kit/prepare_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh

# ninja -j$(nproc) -C build tests
ninja -j$(nproc) -C build install
set -e

# install everest testing by cmake target to make sure using the version defined in dependencies.yaml
ninja -C build install_everest_testing
ninja -C "$EXT_MOUNT/build" install_everest_testing

rsync -a "$EXT_MOUNT/source/tests" ./

rm -rf build
rm -rf "$EXT_MOUNT/build"
4 changes: 3 additions & 1 deletion .ci/build-kit/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

ninja -j$(nproc) -C build test
set -e

ninja -j$(nproc) -C "$EXT_MOUNT/build" test
2 changes: 2 additions & 0 deletions .ci/e2e/scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh

set -e

cd tests
pytest --everest-prefix ../dist core_tests/*.py framework_tests/*.py
96 changes: 84 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT MERGE

- 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 ??
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT MERGE

- 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,84 @@ 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 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 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
Loading