-
Notifications
You must be signed in to change notification settings - Fork 10
197 lines (194 loc) · 6.74 KB
/
cross_compile.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
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: nwchem_crosscompile_docker
on:
schedule:
- cron: '59 15 * * FRI'
repository_dispatch:
types: [backend_automation]
workflow_dispatch:
jobs:
docker_schedule:
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule')
strategy:
fail-fast: false
matrix:
folder:
- nwchem-cross
archs:
- linux/amd64
- linux/arm64
- linux/ppc64le
- linux/riscv64
- linux/s390x
fc: [ gfortran]
branch:
- master
- hotfix/release-7-2-0
runs-on: ubuntu-latest
timeout-minutes: 420
outputs:
tag: ${{ steps.env_tag.outputs.tag }}
tag_noarch: ${{ steps.env_tag_noarch.outputs.tag_noarch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup cache
id: setup-cache
uses: actions/cache@v3
with:
path: |
~/cache
key: ${{ matrix.folder}}-${{ matrix.fc}}/${{ matrix.archs}}-nwchemdockercross-v001
- name: Qemu
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: ${{ matrix.archs }}
- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:v0.11.6
network=host
buildkitd-flags: --debug
- name: Login to GitHub Container Registry
if: ${{ github.actor == github.repository_owner }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Arch
id: get-arch
run: |
echo "arch=$(echo ${{matrix.archs }} | sed 's/linux//'|sed 's/\///g' )" >> $GITHUB_ENV
shell: bash
- name: FC tag
id: fc-tag
run: |
if [[ ${{ matrix.fc }} == 'gfortran' ]]; then
echo "fc=" >> $GITHUB_ENV
else
echo "fc=$(echo -${{matrix.fc }} )" >> $GITHUB_ENV
fi
shell: bash
- name: fetch cache
if: (steps.setup-cache.outputs.cache-hit == 'true')
run: |
cd ${{ matrix.folder }}
ls -lrta
if [[ -f ~/cache/libext.tar.bz2 ]]; then \
echo "libext cache present" ; \
mkdir -p cache|| true ; \
rsync -av ~/cache/libext* cache/. ; \
echo "libext cache fetched" ; \
if [[ -f ~/cache/simint.tar.bz2 ]]; then \
echo "simint cache present" ; \
mkdir -p cache|| true ; \
rsync -av ~/cache/simint* cache/. ; \
echo "simint cache fetched" ; \
fi
ls -l cache/ ; \
echo "======" ; \
fi
echo "cache_hit=Y" >> $GITHUB_ENV
- name: negative-cache-hit-reporter
if: (steps.setup-cache.outputs.cache-hit != 'true')
run: |
echo "cache_hit=N" >> $GITHUB_ENV
- name: nwchem version tag
run: |
if [[ ${{ matrix.branch }} == master ]]; then
echo "nwversion=dev" >> $GITHUB_ENV
elif [[ ${{ matrix.branch }} == hotfix/release-7-2-0 ]]; then
echo "nwversion=720" >> $GITHUB_ENV
else
echo "nwversion=unknown" >> $GITHUB_ENV
fi
shell: bash
- name: docker tag noarch
run: |
echo "tag_noarch=ghcr.io/${{ github.actor }}/nwchemcross-${{ env.nwversion }}${{ env.fc }}" >> $GITHUB_ENV
shell: bash
- name: docker tag
run: |
echo "tag=${{ env.tag_noarch }}:${{ env.arch }}" >> $GITHUB_ENV
shell: bash
- name: echo docker tag to env
id: env_tag
run:
echo "tag=${{ env.tag }}" >> $GITHUB_OUTPUT
- name: echo docker tag_noarch to env
id: env_tag_noarch
run:
echo "tag_noarch=${{ env.tag_noarch }}" >> $GITHUB_OUTPUT
- name: build date
id: build-date
run: |
echo "date=$(TZ=America/Los_Angeles date +%Y%m%d_%H%M%S)" >> $GITHUB_ENV
- name: print env
run: |
echo "GITHUB_ENV" `cat $GITHUB_ENV`
echo " tag " ${{ env.tag }}
- name: modify Dockerfile
run: |
cd ${{ matrix.folder }}
ls
if [[ ${{ matrix.archs }} == 'linux/riscv64' ]]; then
sed -e "s/FROM\ ubuntu\:jammy\ AS\ relink/FROM\ riscv64\/ubuntu\:jammy\ AS\ relink/" Dockerfile > Dockerfile.new
sed -e "s/FROM\ ubuntu\:jammy\ AS\ push/FROM\ riscv64\/ubuntu\:jammy\ AS\ push/" Dockerfile.new > Dockerfile
grep FROM Dockerfile
fi
- name: build_schedule
uses: docker/build-push-action@v5
with:
push: ${{ github.actor == github.repository_owner }}
provenance: false
context: ${{ matrix.folder }}
shm-size: 256m
platforms: ${{ matrix.archs }}
tags: |
${{ env.tag }}
${{ env.tag }}-${{ env.date }}
build-args: |
FC=${{ matrix.fc }}
NWCHEM_BRANCH=${{ matrix.branch }}
CACHE_HIT=${{ env.cache_hit }}
GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }}
- name: load and test image
if: ( github.actor == github.repository_owner )
run: |
sleep 30s
docker pull ${{ env.tag }}
cd /tmp
umask u=rwx,g=rwx,o=rwx
umask -S
svn export https://github.com/nwchemgit/nwchem/trunk/QA >& svnout.log
cd QA
docker run --shm-size 256m --rm --platform ${{matrix.archs }} \
--user 0 --privileged \
-w /opt/nwchem/QA \
-e NWCHEM_EXECUTABLE=/opt/nwchem/bin/nwchem \
--entrypoint='/opt/nwchem/QA/runtests.mpi.unix' \
-v `pwd`:/opt/nwchem/QA ${{ env.tag }} \
dft_he2+ h2o_dk cosmo_h3co
- name: store cache
if: ( github.actor == github.repository_owner )
run: |
mkdir -p ~/cache/
docker run --privileged --user 0 --rm --platform ${{matrix.archs }} \
--entrypoint='/bin/cp' -v ~/cache:/data \
${{ env.tag }} \
-rp /opt/nwchem/src/libext/libext.tar.bz2 /data/. || true
docker run --privileged --user 0 --rm --platform ${{matrix.archs }} \
--entrypoint='/bin/cp' -v ~/cache:/data \
${{ env.tag }} \
-rp /opt/nwchem/src/libext/simint.tar.bz2 /data/. || true
ls -Ralrt ~/cache || true
bundle_images2:
needs: [docker_schedule]
uses: ./.github/workflows/docker_manifest_cross.yml
secrets:
inherit