diff --git a/.ci/build-kit/compile.sh b/.ci/build-kit/compile.sh index cedc73115..95e0259b2 100755 --- a/.ci/build-kit/compile.sh +++ b/.ci/build-kit/compile.sh @@ -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 diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 477aca76f..cd37591d5 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -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/run-clang-format@v1.0.0 + 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: @@ -35,12 +50,6 @@ jobs: uses: actions/checkout@v3 with: path: source - - name: Run clang-format - uses: everest/everest-ci/github-actions/run-clang-format@v1.0.0 - with: - source-dir: source - extensions: hpp,cpp - exclude: cache - name: Setup run scripts run: | mkdir scripts @@ -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: |