diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 07278f965..d179d5ed9 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -41,6 +41,7 @@ jobs: runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} env: CACHE_PATH: /tmp/cache + CI_REPO: EVerest/everest-core steps: - name: Format branch name for cache key run: | @@ -55,24 +56,17 @@ jobs: restore-keys: | compile-${{ env.branch_name_for_cache }}- compile- - - name: Checkout from `everest-core` the `.ci/` directory (reusable workflow mode, see https://stackoverflow.com/a/74123003/1168315) + - name: Checkout `${{ env.CI_REPO }}` (to only get the `.ci/` directory if reusable workflow mode, see https://stackoverflow.com/a/74123003/1168315) uses: actions/checkout@v4 with: - sparse-checkout: | - .ci - repository: EVerest/everest-core + path: ci-repo + repository: ${{ env.CI_REPO }} ref: CI/reusable-workflow # TODO get reference in general, see https://stackoverflow.com/questions/74784735 resp. https://github.com/actions/toolkit/issues/1264 - - name: Move `.ci/` to `/tmp` and remove `everest-core` - run: | - mv .ci /tmp - pwd && ls -hal . - cd .. - pwd && ls -hal . - rm -rf everest-core - pwd && ls -hal . - - name: Checkout repo ${{ inputs.repository || 'EVerest/everest-core' }} + - name: Checkout repo ${{ inputs.repository }} + if: ${{ github.repository != env.CI_REPO }} uses: actions/checkout@v4 with: + path: source repository: ${{ inputs.repository }} ref: ${{ inputs.repository_ref }} - name: Pull build-kit image @@ -82,11 +76,12 @@ jobs: - name: Build and install env: CMAKE_FLAGS_EXTRA: ${{ inputs.cmake_flags_extra || '-DEVC_ENABLE_CCACHE=1 -DISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES=OFF' }} + working-directory: source run: | ls -hal . docker run \ --volume "${CACHE_PATH:?}:/ext/cache" \ - --volume "/tmp/.ci:/.ci" \ + --volume "ci-repo/.ci:/.ci" \ --volume "$(pwd):$(pwd)" \ --workdir "$(pwd)" \ --env CMAKE_FLAGS_EXTRA="${CMAKE_FLAGS_EXTRA:?}" \ @@ -100,20 +95,22 @@ jobs: path: build/CMakeFiles/ - name: Unit tests if: ${{ inputs.unit_tests || false }} + working-directory: source run: | docker commit build-container unit-tests-image trap "cp build/Testing/Temporary/LastTest.log /tmp/ctest-report" EXIT docker run \ + --volume "ci-repo/.ci:/.ci" \ --volume "$(pwd):$(pwd)" \ - --volume "/tmp/.ci:/.ci" \ --workdir "$(pwd)" \ --name test-container \ unit-tests-image /.ci/build-kit/unit_tests.sh - name: Integration tests if: ${{ inputs.integration_tests || true }} - working-directory: /tmp/.ci/e2e/ + working-directory: source run: | docker commit build-container integration-tests-image + pushd ci-repo/.ci/e2e/ docker-compose run e2e-test-server scripts/tests.sh - name: FIXME make all files in `cache/` readable # FIXME Workaround for non-readable certs in `cache/josev/[ID]/Josev/iso15118/shared/pki/iso15118_2/certs . See https://github.com/EVerest/everest-core/actions/runs/7286554315/job/19855498928#step:13:10