-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 4.15 KB
/
docker-builds.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
name: build containers metrics-operator
on:
pull_request: []
push:
branches:
- main
jobs:
build-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [["sysstat", "ghcr.io/converged-computing/metric-sysstat:latest"],
["osu-benchmark", "ghcr.io/converged-computing/metric-osu-benchmark:latest"],
["fio", "ghcr.io/converged-computing/metric-fio:latest"],
["amg", "ghcr.io/converged-computing/metric-amg:latest"],
["hwloc", "ghcr.io/converged-computing/metric-hwloc:latest"],
["chatterbug", "ghcr.io/converged-computing/metric-chatterbug:latest"],
["pennant", "ghcr.io/converged-computing/metric-pennant:latest"],
["hpl-spack", "ghcr.io/converged-computing/metric-hpl-spack:latest"],
["hpl", "ghcr.io/converged-computing/metric-hpl:latest"],
["ior", "ghcr.io/converged-computing/metric-ior:latest"],
["charmpp", "ghcr.io/converged-computing/metric-charmpp:latest"],
["qmcpack", "ghcr.io/converged-computing/metric-qmcpack:latest"],
["quicksilver", "ghcr.io/converged-computing/metric-quicksilver:latest"],
["ovis-hpc", "ghcr.io/converged-computing/metric-ovis-hpc:latest"],
["kripke", "ghcr.io/converged-computing/metric-kripke:latest"],
["hpctoolkit-viewer", "ghcr.io/converged-computing/metric-hpctoolkit-viewer:latest"],
["hpctoolkit-view", "ghcr.io/converged-computing/metric-hpctoolkit-view:ubuntu"],
["hpctoolkit-view-rocky", "ghcr.io/converged-computing/metric-hpctoolkit-view:rocky"],
["hpctoolkit-spack", "ghcr.io/converged-computing/metric-hpctoolkit-spack:latest"],
["hpctoolkit", "ghcr.io/converged-computing/metric-hpctoolkit:latest"],
["bdas", "ghcr.io/converged-computing/metric-bdas:latest"],
["laghos", "ghcr.io/converged-computing/metric-laghos:latest"],
["nekbone", "ghcr.io/converged-computing/metric-nekbone:latest"],
["lammps-intel-mpi-rocky", "ghcr.io/converged-computing/metric-lammps-intel-mpi:rocky"],
["lammps", "ghcr.io/converged-computing/metric-lammps:latest"],
["perf-kit-benchmarker", "ghcr.io/converged-computing/metric-perf-kit-benchmarker:latest"]]
steps:
- name: Clone the code
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Layers (if exist)
env:
container: ${{ matrix.test[1] }}
run: docker pull ${container} || echo "${container} not pushed yet"
- name: Make Space For Build
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
- name: Build Container
env:
context: ${{ matrix.test[0] }}
container: ${{ matrix.test[1] }}
run: |
cd ${context}
dockerfile=$(realpath Dockerfile)
dobuild="no"
cd -
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
file=$(realpath $file)
echo "Looking at changed file ${file}"
if [[ "$file" == "$dockerfile" ]]; then
echo "$file was changed and warrants build"
cd ${context}
docker build -t ${container} .
dobuild="yes"
fi
# Exit after we have found the match
if [[ "$dobuild" == "yes" ]]; then
break
fi
done
echo "dobuild=${dobuild}" >> $GITHUB_ENV
- name: Deploy Container
if: (github.event_name != 'pull_request' && env.dobuild == 'yes')
env:
container: ${{ matrix.test[1] }}
run: docker push ${container}