Merge pull request #19 from radical-cybertools/feature/deploy #2
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: Test container build and tutorials | |
on: | |
push: | |
branches: | |
- main | |
env: | |
TUTORIAL_TAG: tutorial_tag_local | |
TUTORIAL_IMAGE_NAME: tutorial_image | |
jobs: | |
build: | |
name: Build container locally | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/build-push-action@v6 | |
with: | |
context: ./src/ | |
file: ./docker/Dockerfile | |
build-args: | | |
TUTORIAL_NAME=latest | |
tags: ${{ env.TUTORIAL_TAG }} | |
outputs: type=docker,dest=/tmp/${{ env.TUTORIAL_IMAGE_NAME }}.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.TUTORIAL_IMAGE_NAME }} | |
path: /tmp/${{ env.TUTORIAL_IMAGE_NAME }}.tar | |
retention-days: 1 | |
overwrite: true | |
tests: | |
name: Test tutorials from docker container | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
tutorial: ['radical-pilot', 'radical-entk', 'parsl-rp', 'deepdrivemd'] | |
env: | |
TARGET_PATH: /tutorials/${{ matrix.tutorial }}/*.ipynb | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.TUTORIAL_IMAGE_NAME }} | |
path: /tmp | |
- name: Load tutorial image | |
run: | | |
docker load --input /tmp/${{ env.TUTORIAL_IMAGE_NAME }}.tar | |
docker image ls -a | |
- name: Run tutorials | |
timeout-minutes: 15 | |
run: | | |
docker run ${{ env.TUTORIAL_TAG }} bash -c "\ | |
jupyter nbconvert --clear-output --inplace ${{ env.TARGET_PATH }} && \ | |
jupyter nbconvert --to notebook --execute --inplace ${{ env.TARGET_PATH }}" | |
deploy: | |
name: Push container to DockerHub | |
needs: tests | |
uses: ./.github/workflows/deploy.yml | |
secrets: inherit | |