Skip to content

Commit

Permalink
test docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Apr 24, 2024
1 parent 6bd248a commit 29fec50
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 10 deletions.
115 changes: 105 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,111 @@ on:
- semrel

jobs:
release:
build:
runs-on: ubuntu-latest
steps:
- name: Define environment variables
run: |
REGISTRY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
echo IMAGE_BUILDCACHE=${REGISTRY}:buildcache >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build container
uses: docker/build-push-action@v5
with:
file: Dockerfile.test
tags: ${{ env.IMAGE_BUILDCACHE }}
push: true
#cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
#outputs: type=docker,dest=/tmp/esi-opticks-${{ github.sha }}.tar

#- name: Upload image for test jobs
# uses: actions/upload-artifact@v4
# with:
# name: esi-opticks-${{ github.sha }}
# path: /tmp/esi-opticks-${{ github.sha }}.tar

test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Define environment variables
run: |
REGISTRY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
echo IMAGE_BUILDCACHE=${REGISTRY}:buildcache >> $GITHUB_ENV
#- name: Checkout Code
# uses: actions/checkout@v4

##- run: .github/workflows/set_github_env.sh

##- name: Download Image
## uses: actions/download-artifact@v4
## with:
## name: esi-opticks-${{ github.sha }}
## path: /tmp

#- name: Set up Docker buildx
# uses: docker/setup-buildx-action@v3

#- name: Login to GitHub container registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

#- name: Build container
# uses: docker/build-push-action@v5
# with:
# file: Dockerfile.test
# tags: ${{ env.IMAGE_BUILDCACHE }}
# pull: true
# load: true
# cache-from: type=registry,ref=${{ env.IMAGE_BUILDCACHE }}

- name: Run tests
run: |
docker run ${{ env.IMAGE_BUILDCACHE }} curl --version
#docker load --input /tmp/esi-opticks-${{ github.sha }}.tar
release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Important for Semantic Release to analyze all commits

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important for Semantic Release to analyze all commits

#- name: Semantic Release
# uses: cycjimmy/semantic-release-action@v4
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#- name: Download Image
# uses: actions/download-artifact@v4
# with:
# name: esi-opticks-${{ github.sha }}
# path: /tmp

#- name: Release
# run: |
# docker load --input /tmp/esi-opticks-${{ github.sha }}.tar
# docker tag ghcr.io/${{ github.repository_owner }}/esi-opticks:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/esi-opticks:latest
# docker tag ghcr.io/${{ github.repository_owner }}/esi-opticks:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/esi-opticks:latest
# ${{ steps.semantic.outputs.new_release_version }}
# docker push ghcr.io/${{ github.repository_owner }}/esi-opticks:${{ github.sha }}
6 changes: 6 additions & 0 deletions .github/workflows/set_github_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

REGISTRY=ghcr.io/$(echo ${GITHUB_REPOSITORY-notset} | tr '[:upper:]' '[:lower:]')
GITHUB_SHA_8=$(echo ${GITHUB_SHA-notset} | cut -c 1-8)
echo REGISTRY=$REGISTRY >> $GITHUB_ENV
echo IMAGE_SHA=${REGISTRY}/esi-opticks:${GITHUB_SHA_8} >> $GITHUB_ENV
7 changes: 7 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# syntax=docker/dockerfile:latest

FROM nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y curl

0 comments on commit 29fec50

Please sign in to comment.