-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (124 loc) · 4.98 KB
/
docker_publish.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build & Publish docker image for PyNE-CI
on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths:
- 'docker/*'
- '.github/workflows/docker_publish.yml'
- '.github/actions/build-test/action.yml'
push:
paths:
- 'docker/*'
- '.github/workflows/docker_publish.yml'
- '.github/actions/build-test/action.yml'
env:
DOCKER_IMAGE_BASENAME: ghcr.io/${{ github.repository_owner }}/pyne_ubuntu_22.04_py3
USE_LATEST_TAG: false
jobs:
# builds and pushes docker images of various stages to ghcr.
# These docker images are also stored in ghcr and can be pulled
# to be built upon by the subsequent stage.
multistage_image_build:
runs-on: ubuntu-latest
strategy:
matrix:
pkg_mgr: ['apt', 'conda']
hdf5: ['']
hdf5_build_arg: ['NO']
include:
- hdf5: _hdf5
hdf5_build_arg: hdf5-1_12_0
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag images with latest if on the main repo's develop branch
if: github.repository_owner == 'pyne' && github.ref_name == 'develop'
run: echo "USE_LATEST_TAG=true" >> $GITHUB_ENV
# build base python, moab, dagmc, openmc using multistage docker build action
- uses: firehed/multistage-docker-build-action@v1
id: build_all_stages
with:
repository: ${{ env.DOCKER_IMAGE_BASENAME }}_${{ matrix.pkg_mgr }}${{ matrix.hdf5 }}
stages: common_base, ${{ matrix.pkg_mgr }}_deps, base_python, moab, dagmc
server-stage: openmc
quiet: false
parallel: true
tag-latest-on-default: ${{ env.USE_LATEST_TAG }}
dockerfile: docker/ubuntu_22.04-dev.dockerfile
build-args: pkg_mgr = ${{ matrix.pkg_mgr }}, build_hdf5=${{ matrix.hdf5_build_arg }}, pyne_test_base=openmc
# Downloads the images uploaded to ghcr in previous stages and runs pyne
# tests to check that they work.
BuildTest:
needs: [multistage_image_build]
runs-on: ubuntu-latest
strategy:
matrix:
pkg_mgr: ['apt', 'conda']
pyne_test_base: [base_python, moab, dagmc, openmc]
hdf5: ['']
hdf5_build_arg: ['NO']
include:
- pyne_test_base: dagmc
hdf5: _hdf5
hdf5_build_arg: hdf5-1_12_0
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag images with latest if on the main repo's develop branch
if: github.repository_owner == 'pyne' && github.ref_name == 'develop'
run: echo "USE_LATEST_TAG=true" >> $GITHUB_ENV
# build test stage and pyne-dev stage using multistage docker build action
- uses: firehed/multistage-docker-build-action@v1
id: multistage_build_and_test
with:
repository: ${{ env.DOCKER_IMAGE_BASENAME }}_${{ matrix.pkg_mgr }}${{ matrix.hdf5 }}
stages: ${{ matrix.pyne_test_base }}
server-stage: pyne-dev
quiet: false
parallel: true
tag-latest-on-default: ${{ env.USE_LATEST_TAG }}
dockerfile: docker/ubuntu_22.04-dev.dockerfile
build-args: pkg_mgr = ${{ matrix.pkg_mgr }}, build_hdf5=${{ matrix.hdf5_build_arg }}, pyne_test_base=${{ matrix.pyne_test_base }}
# if the previous step that tests the docker images passes then the images
# can be copied from the ghcr where they are saved using :ci_testing tags to
# :latest and :stable tags.
pushing_test_stable_img:
if: github.repository_owner == 'pyne' && github.ref_name == 'develop'
needs: [BuildTest]
runs-on: ubuntu-latest
strategy:
matrix:
pkg_mgr: ['apt', 'conda']
stage: [base_python, moab, dagmc, openmc]
hdf5: ['']
include:
- stage: dagmc
hdf5: _hdf5
name: "ghcr.io/${{ github.repository_owner }}/pyne_ubuntu_22.04_py3_${{ matrix.pkg_mgr }}${{ matrix.hdf5 }}/${{ matrix.stage }}: latest -> stable"
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image to stable img
uses: akhilerm/[email protected]
with:
src: ${{ env.DOCKER_IMAGE_BASENAME }}_${{ matrix.pkg_mgr }}${{ matrix.hdf5 }}/${{ matrix.stage }}:latest
dst: ${{ env.DOCKER_IMAGE_BASENAME }}_${{ matrix.pkg_mgr }}${{ matrix.hdf5 }}/${{ matrix.stage }}:stable