-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.31 KB
/
ci.yaml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: ci
on:
push:
tags:
- 'v*'
pull_request:
env:
TEST_TAG: pyansys-base-image:test
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
github-token: ${{ github.token }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=semver,pattern=v{{major}}.{{minor}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and export to Docker
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest
- name: Test
run: >-
docker run --rm
-v `pwd`/test_notebooks:/test_notebooks
--user $(id -u):$(id -g) -e HOME=/tmp
${{ env.TEST_TAG }}
jupyter nbconvert --to html --execute /test_notebooks/* --output-dir=/test_notebooks/out
- name: Save notebook HTML out
uses: actions/upload-artifact@v2
with:
name: test-notebooks-html-out
path: test_notebooks/out/*.html
- name: Push the image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name == 'push' && contains(github.ref, '/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }}:latest
cache-to: type=inline
secrets: |
"github_token=${{ steps.get_workflow_token.outputs.token }}"