SBRA-736 add coverage for the functional tests #266
Workflow file for this run
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: Publish Docker image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
push_to_registries: | |
name: Push Docker image to multiple registries | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
model-project: | |
- reactive-flows/cnf-combustion/gnns | |
- reactive-flows/cnf-combustion/unets | |
- weather-forecast/gravity-wave-drag/cnns | |
- weather-forecast/ecrad-3d-correction/unets | |
fail-fast: false | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
- name: Split version code | |
uses: xom9ikk/split@v1 | |
id: split_path | |
with: | |
string: ${{ matrix.model-project }} | |
separator: / | |
limit: -1 | |
- name: Split version code | |
uses: xom9ikk/split@v1 | |
id: split_tag | |
with: | |
string: ${{ steps.meta.outputs.tags }} | |
separator: ":" | |
limit: -1 | |
- name: Build the Docker image name and tag | |
id: image | |
run: | | |
echo "name=${{ steps.split_tag.outputs._0 }}" >> "$GITHUB_OUTPUT" | |
echo "tag=${{ steps.split_path.outputs._0 }}-${{ steps.split_path.outputs._1 }}-${{ steps.split_path.outputs._2 }}" >> "$GITHUB_OUTPUT" | |
- name: Read model-project env.yaml file | |
uses: pietrobolcato/[email protected] | |
id: uc_env | |
with: | |
config: ${{ matrix.model-project }}/env.yaml | |
- name: Build the Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: "./docker/Dockerfile" | |
build-args: | | |
UBUNTU_IMAGE_NAME=${{ steps.uc_env.outputs['ubuntu_base_image.name'] }} | |
UBUNTU_IMAGE_TAG=${{ steps.uc_env.outputs['ubuntu_base_image.tag'] }} | |
PYTHON_VERS=${{ steps.uc_env.outputs['python_version'] }} | |
MODEL_PROJECT_PATH=${{ matrix.model-project }} | |
load: true | |
tags: "${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}" | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Test the Docker image | |
working-directory: ${{ matrix.model-project }} | |
run: | | |
docker run \ | |
--rm \ | |
-w /home/ai4sim/${{ matrix.model-project }} \ | |
${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }} \ | |
nox -s train_test --no-venv -v -- clean_data | |
- name: Push the previously built Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: "./docker/Dockerfile" | |
build-args: | | |
UBUNTU_IMAGE_NAME=${{ steps.uc_env.outputs['ubuntu_base_image.name'] }} | |
UBUNTU_IMAGE_TAG=${{ steps.uc_env.outputs['ubuntu_base_image.tag'] }} | |
PYTHON_VERS=${{ steps.uc_env.outputs['python_version'] }} | |
MODEL_PROJECT_PATH=${{ matrix.model-project }} | |
push: true | |
tags: "${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}" | |
labels: ${{ steps.meta.outputs.labels }} |