#2: rebuild docker images in CI #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build docker image | |
on: | |
push: | |
branches: | |
- develop | |
- 2-implement-common-docker-containers | |
jobs: | |
get-matrix: | |
name: Get matrix | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CI_REPO: DARMA-tasking/workflows | |
CI_BRANCH: master | |
steps: | |
- name: Get matrix | |
id: get-matrix | |
run: | | |
wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/matrix/github.json | |
matrix=$(cat github.json | jq '.matrix' | jq -c '[ .[] | select( .image != null) ]') | |
echo "runner=$(echo $matrix)" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.get-matrix.outputs.runner }} | |
build-image: | |
name: Build ${{ matrix.runner.name }} | |
runs-on: ${{ matrix.runner.runs-on }} | |
needs: get-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: ${{ fromJson(needs.get-matrix.outputs.matrix ) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- run: pip install pyyaml | |
- name: Build Docker image | |
run: | | |
python ci/build-docker-image.py ${{ matrix.runner.image }} | |
docker image inspect ${{ matrix.runner.image }} | |
- name: Test Docker image (VT build & test) | |
run: | | |
CMD='echo "CC=$CC" ; \ | |
echo "CXX=$CXX" ; \ | |
echo "FC=$FC" ; \ | |
echo "CMPLR_ROOT=$CMPLR_ROOT" ; \ | |
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" ; \ | |
echo "CPATH=$CPATH" ; \ | |
echo "INFOPATH=$INFOPATH" ; \ | |
echo "INTEL_LICENSE_FILE=$INTEL_LICENSE_FILE" ; \ | |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" ; \ | |
echo "LIBRARY_PATH=$LIBRARY_PATH" ; \ | |
echo "ONEAPI_ROOT=$ONEAPI_ROOT" ; \ | |
echo "PATH=$PATH" ; \ | |
echo "TBBROOT=$TBBROOT" ; \ | |
mkdir -p "/opt/vt/src" "/opt/vt/build/vt" ; \ | |
git clone https://github.com/DARMA-tasking/vt /opt/vt/src ; \ | |
cd /opt/vt/src ; \ | |
bash ci/build_cpp.sh /opt/vt/src /opt/vt/build ; \ | |
bash ci/test_cpp.sh /opt/vt/src /opt/vt/build ; \ | |
bash ci/build_vt_sample.sh /opt/vt/src /opt/vt/build ; | |
rm -rf "/opt/vt/src" "/opt/vt/build"' | |
echo "Running ${CMD}" | |
docker run \ | |
--name test-container \ | |
-e CI="1" \ | |
-e CMAKE_CXX_STANDARD="17" \ | |
-e CMAKE_BUILD_TYPE="Release" \ | |
${{ matrix.runner.image }} \ | |
bash -c "$CMD" | |
exit $(docker container inspect --format '{{.State.ExitCode}}' test-container) | |
- name: Push Docker image to DockerHub Container Registry | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} | |
docker push ${{ matrix.runner.image }} |