generated from bwbioinfo/docker-cwl-template
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (50 loc) · 1.67 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and Test Docker Image
on:
push:
paths:
- "docker/Dockerfile"
workflow_dispatch:
pull_request:
types: [opened, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: get-name
run: |
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
echo "REPO_OWNER=$(echo ${{ github.repository_owner}} | tr '[:upper:]' '[:lower:]' )" >> $GITHUB_ENV
- name: Build Docker image
run: |
docker build \
-t ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest --output type=tar,dest=/tmp/${{ env.REPO_NAME }}.tar . -f docker/Dockerfile
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPO_NAME }}
path: /tmp/${{ env.REPO_NAME }}.tar
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: get-name
run: |
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
echo "REPO_OWNER=$(echo ${{ github.repository_owner}} | tr '[:upper:]' '[:lower:]' )" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.REPO_NAME }}
path: /tmp/
- name: Veriify File Exists
run: |
ls -l /tmp/${{ env.REPO_NAME }}.tar
stat /tmp/${{ env.REPO_NAME }}.tar
- name: Load image
run: |
cat /tmp/${{ env.REPO_NAME }}.tar | docker import - ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest
docker image ls -a