Comments aren't be recognized, trying :# marker from stackoverflow. #1075
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: ATS CI | |
on: | |
workflow_dispatch: | |
branches: | |
- '**' | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- ats-* | |
jobs: | |
build_test: | |
runs-on: ubuntu-latest | |
name: Build and test with Docker | |
steps: | |
- name: Check out the Amanzi repo | |
uses: actions/checkout@v4 | |
with: | |
repository: amanzi/amanzi | |
ref: master | |
submodules: recursive | |
- name: Extract the ATS branch name | |
id: branch | |
working-directory: Docker | |
run: | | |
echo "ATS_BRANCH=$GITHUB_REF_NAME" >> $GITHUB_ENV | |
- name: Does Amanzi branch of the same name exist? | |
id: amanzi_branch | |
run: | | |
: # This should really be smarter, dropping the name marker for example | |
: # echo "AMANZI_BRANCH=$(git ls-remote --heads origin ${GITHUB_REF_NAME} | sed 's/.*refs\/heads\///')" >> $GITHUB_ENV | |
echo "AMANZI_BRANCH=ecoon/amanzi-tpls-0.98.9" >> $GITHUB_ENV | |
- name: If so, checkout Amanzi to get the right TPLs version | |
id: amanzi_branch_checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: amanzi/amanzi | |
ref: ${{env.AMANZI_BRANCH}} | |
submodules: recursive | |
- name: Does ats-regression-tests branch of the same name exist? | |
id: ats_tests_branch | |
working-directory: src/physics/ats/testing/ats-regression-tests | |
run: | | |
: # This should really be a conditional, if the first test is empty, then fall back to master. | |
: # echo "ATS_TESTS_BRANCH=$(git ls-remote --heads origin ${GITHUB_REF_NAME} | sed 's/.*refs\/heads\///')" >> $GITHUB_ENV | |
: # Hard code special case for now: | |
echo "ATS_TESTS_BRANCH=sergi/amanzi-tpls-0.98.8" >> $GITHUB_ENV | |
- name: Filter the branch name to generate a tag for Docker | |
id: tag | |
run: | | |
echo "ATS_BRANCH_TAG=$(echo ${{env.ATS_BRANCH}} | sed -e 's/\//--/g')" >> $GITHUB_ENV | |
- name: Get TPLs version | |
id: version | |
working-directory: Docker | |
run: | | |
echo "AMANZI_TPLS_VER=$(./get_tpls_version.sh)" >> $GITHUB_ENV | |
- name: Print out environment | |
run: | | |
echo "Amanzi branch = ${{env.AMANZI_BRANCH}}"; | |
echo "ATS branch = ${{env.ATS_BRANCH}}"; | |
echo "ats-regression-tests branch = ${{env.ATS_TESTS_BRANCH}}"; | |
echo "Tag reference = ${{env.ATS_BRANCH_TAG}}" | |
echo "TPLs version = ${{env.AMANZI_TPLS_VER}}" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_PASSWORD}} | |
- name: Docker build | |
id: docker | |
working-directory: Docker | |
run: | |
docker build --build-arg amanzi_branch=${{env.AMANZI_BRANCH}} --build-arg ats_branch=${{env.ATS_BRANCH}} --build-arg ats_tests_branch=${{env.ATS_TESTS_BRANCH}} --build-arg amanzi_tpls_ver=${{env.AMANZI_TPLS_VER}} -t metsi/ats:${{env.ATS_BRANCH_TAG}}-latest -f Dockerfile-ATS-build . | |
- name: Docker push | |
working-directory: Docker | |
run: | |
docker push ${{secrets.DOCKERHUB_USERNAME}}/ats:${{env.ATS_BRANCH_TAG}}-latest | |
- name: Run tests | |
id: tests | |
working-directory: Docker | |
run: | |
docker run --rm ${{secrets.DOCKERHUB_USERNAME}}/ats:${{env.ATS_BRANCH_TAG}}-latest /bin/bash -c "cd ~/amanzi_builddir/ats; ctest" | |