-
Notifications
You must be signed in to change notification settings - Fork 3
198 lines (171 loc) · 5.82 KB
/
gh-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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Docker build
on:
push:
branches:
- main
tags:
- "*"
pull_request:
env:
DOCKER_ORG: coffeateam
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
# Update each time there is added latest python: it will be used for `latest` tag
python_latest: "3.11"
release: 2024.4.1
releasev0: 0.7.22
jobs:
matrix-build:
strategy:
fail-fast: false
matrix:
image_dir: [coffea-base, coffea-dask]
distro: [almalinux8]
python: ["3.9", "3.10", "3.11"]
exclude:
- distro: almalinux8
python: 3.9
- image_dir: coffea-base
python: 3.11
name: ${{ matrix.image_dir }}-${{ matrix.distro }}-${{ matrix.python }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKERHUB_ACCOUNT }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Harbor Hub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: hub.opensciencegrid.org
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Generate tags
id: tags
env:
image_dir: ${{ matrix.image_dir }}
python: ${{ matrix.python }}
distro: ${{ matrix.distro }}
releasev0: ${{ env.releasev0 }}
release: ${{ env.release }}
python_latest: ${{ env.python_latest}}
run: |
image="coffeateam/${image_dir}-${distro}"
image_default="coffeateam/${image_dir}"
if [ ${image_dir} == 'coffea-base' ]; then
tag="${image}:${releasev0}-py${python}"
else
tag="${image}:${release}-py${python}"
fi
## Default image name for dask-base and dask-dask
#if [ ${distro} == 'alma8' ]; then
# tag_default="${image_default}:${releasev0}-py${python},${image_default}:${release}-py${python}"
#fi
if [ ${python} == ${python_latest} ]; then
latest=${image}:latest
## Let's overwrite latest
#if [ ${distro} == 'alma8' ]; then
# latest="${image_default}:latest
#fi
fi
#tags=$tag,${image}:latest-py${python},$latest,$tag_default
tags=$tag,${image}:latest-py${python},$latest
echo "::set-output name=tag::${tag}"
echo "::set-output name=tags::${tags}"
- name: Build base v0
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}
- name: Build base v1
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Test Conda environement
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm ${tag} conda list --export
- name: Make sure voms tools are working
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
ERROR=$(docker run ${tag} voms-proxy-info 2>&1 > /dev/null; exit 0)
TEST=$(echo -e "\nCouldn't find a valid proxy.\n")
if [ "$ERROR" == "$TEST" ]; then
exit 0
else
exit 1
fi
- name: Test Pytest environement v0
if: ${{ matrix.image_dir == 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m v0"
- name: Test Pytest environement CalVer
if: ${{ matrix.image_dir != 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m calver"
- name: Build and push v0
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Build and push v1
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}