-
Notifications
You must be signed in to change notification settings - Fork 14
173 lines (146 loc) · 6.28 KB
/
build-fuzzy.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
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
---
name: Build Fuzzy Environments
on:
push:
branches: ['*']
pull_request:
branches: ['*']
jobs:
fuzzy:
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: Dockerfile
strategy:
max-parallel: 1
matrix:
include:
- NAME: Lapack + Libmath
DOCKER_FROM: ""
DOCKER_TO: fuzzy_v0.6.0-lapack
DOCKER_IMAGE: verificarlo/fuzzy:v0.6.0-lapack
DOCKER_FILE: ./docker/base/Dockerfile.ubuntu20.04-0-lapack-libmath
- NAME: Python
DOCKER_FROM: fuzzy_v0.6.0-lapack
DOCKER_TO: fuzzy_v0.6.0-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:v0.6.0-lapack-python3.8.5
DOCKER_FILE: ./docker/base/Dockerfile.ubuntu20.04-1-python
- NAME: Numpy
DOCKER_FROM: fuzzy_v0.6.0-lapack-python3.8.5
DOCKER_TO: fuzzy_v0.6.0-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:v0.6.0-lapack-python3.8.5-numpy
DOCKER_FILE: ./docker/base/Dockerfile.ubuntu20.04-2-numpy
- NAME: Scipy
DOCKER_FROM: fuzzy_v0.6.0-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_v0.6.0-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:v0.6.0-lapack-python3.8.5-numpy-scipy
DOCKER_FILE: ./docker/base/Dockerfile.ubuntu20.04-3-scipy
- NAME: Scikit-Learn
DOCKER_FROM: fuzzy_v0.6.0-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_v0.6.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:v0.6.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FILE: ./docker/base/Dockerfile.ubuntu20.04-4-sklearn
name: ${{ matrix.NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes
- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}
- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
continue-on-error: true
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ matrix.DOCKER_FROM }}
path: /tmp
- name: (optionally) Load, Build, and (optionally) Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if [ ! -z ${{ matrix.DOCKER_FROM }} ]
then
docker load --input /tmp/${{ matrix.DOCKER_FROM }}.tar
docker image ls -a
fi
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
-f ${{ matrix.DOCKER_FILE }} \
--build-arg VERIFICARLO_VERSION=v0.6.0
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
if ${{ env.PUSH }}
then
docker push ${{ matrix.DOCKER_IMAGE }}
fi
- name: Upload Docker artifacts
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.DOCKER_TO }}
path: /tmp/${{ matrix.DOCKER_TO }}.tar
rename-publish:
needs: fuzzy
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: docker
DOCKER_FROM: fuzzy_v0.6.0-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy
DOCKER_FROM_TAG: v0.6.0-lapack-python3.8.5-numpy-scipy-sklearn
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes
- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}
- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ env.DOCKER_FROM }}
path: /tmp
- name: (optionally) Load, Rename, and Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
docker load --input /tmp/${{ env.DOCKER_FROM }}.tar
docker image ls -a
docker image tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_FROM_TAG }} \
${{ env.DOCKER_IMAGE }}:latest
if ${{ env.PUSH }}
then
docker push ${{ env.DOCKER_IMAGE }}:latest
fi