nwchem_crosscompile_docker #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |