Skip to content

Commit

Permalink
Merge pull request #19 from radical-cybertools/feature/deploy
Browse files Browse the repository at this point in the history
added github action to test and push tutorials container
  • Loading branch information
mtitov authored Dec 25, 2024
2 parents 454a6c7 + 0c4283a commit 404b446
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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

39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy RADICAL-Tutorials container
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
on:
# https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event
repository_dispatch:
types: [ deploy-on-demand ]
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
deploy:
name: Push docker image
runs-on: ubuntu-latest
env:
TUTORIAL_TAG: radicalcybertools/tutorials:latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: ./src/
file: ./docker/Dockerfile
build-args: |
TUTORIAL_NAME=latest
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.TUTORIAL_TAG }}

0 comments on commit 404b446

Please sign in to comment.