-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (112 loc) · 4.04 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: build lammps matrix
on:
pull_request: []
push:
branches:
- main
jobs:
build-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test:
# Note that rocky 8 doesn't have support for additional platforms
- ["intel-mpi-rocky", "8", "linux/amd64"]
- ["intel-mpi-rocky", "9", "linux/amd64"]
# Debug on an aws instance or locally
# - ["intel-mpi-rocky", "9", "linux/arm64"]
- ["openmpi-ubuntu", "20.04", "linux/amd64"]
- ["openmpi-ubuntu", "20.04", "linux/arm64"]
- ["openmpi-ubuntu", "20.04", "linux/ppc64le"]
- ["openmpi-ubuntu", "22.04", "linux/amd64"]
- ["openmpi-ubuntu", "22.04", "linux/arm64"]
- ["openmpi-ubuntu", "22.04", "linux/ppc64le"]
- ["openmpi-ubuntu-vtune", "22.04", "linux/amd64"]
- ["openmpi-ubuntu-vtune", "22.04", "linux/arm64"]
# To be built on larger fs machines
#- ["openmpi-ubuntu-gpu", "22.04", "linux/amd64"]
#- ["openmpi-ubuntu-gpu", "22.04", "linux/arm64"]
#- ["openmpi-ubuntu-gpu", "20.04", "linux/amd64"]
#- ["openmpi-ubuntu-gpu", "20.04", "linux/arm64"]
- ["mpich-ubuntu", "20.04", "linux/amd64"]
- ["mpich-ubuntu", "20.04", "linux/arm64"]
- ["mpich-ubuntu", "20.04", "linux/ppc64le"]
- ["mpich-ubuntu", "22.04", "linux/amd64"]
- ["mpich-ubuntu", "22.04", "linux/arm64"]
- ["mpich-ubuntu", "22.04", "linux/ppc64le"]
name: ${{ matrix.test[0] }}-${{ matrix.test[1] }}-${{ matrix.test[2] }}
steps:
- name: Clone the code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ matrix.platform }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- 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: Define container name
env:
uri: ${{ matrix.test[0] }}
tag: ${{ matrix.test[1] }}
arch: ${{ matrix.test[2] }}
run: |
arch=$(python -c "print('${arch}'.split('/')[1])")
container=ghcr.io/rse-ops/lammps-matrix:${uri}-${tag}-${arch}
echo "container=${container}" >> $GITHUB_ENV
- name: Pull Layers (if exist)
env:
container: ${{ env.container }}
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
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Check Container
env:
context: ${{ matrix.test[0] }}
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"
dobuild="yes"
fi
# Exit after we have found the match
if [[ "$dobuild" == "yes" ]]; then
break
fi
done
echo "dobuild=${dobuild}" >> $GITHUB_ENV
- name: Build and Deploy
if: (env.dobuild == 'yes')
id: build
uses: docker/build-push-action@v3
with:
context: ${{ matrix.test[0] }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ matrix.test[2] }}
build-args: |
tag=${{ matrix.test[1] }}
tags: |
${{ env.container }}