Skip to content

Commit

Permalink
add local builds script and ci logic to only build changed files (#2)
Browse files Browse the repository at this point in the history
* add local builds script and ci logic to only build changed files

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch authored Jan 22, 2024
1 parent f369e64 commit e31d66e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
- 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:
Expand Down Expand Up @@ -80,7 +84,30 @@ jobs:
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:
Expand Down
24 changes: 24 additions & 0 deletions local-builds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# These need more room, and thus are done locally

# openmpi-ubuntu-gpu on amd64
docker buildx build --platform linux/amd64 --build-arg tag=20.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-amd64 openmpi-ubuntu-gpu/
docker buildx build --platform linux/amd64 --build-arg tag=22.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-amd64 openmpi-ubuntu-gpu/

docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-amd64
docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-amd64

# openmpi-ubuntu-gpu on arm64
docker buildx build --platform linux/arm64 --build-arg tag=20.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-arm64 openmpi-ubuntu-gpu/
docker buildx build --platform linux/arm64 --build-arg tag=22.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-arm64 openmpi-ubuntu-gpu/

docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-arm64
docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-arm64

# openmpi-ubuntu-gpu on ppc64le
docker buildx build --platform linux/arm64 --build-arg tag=20.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-ppc64le openmpi-ubuntu-gpu/
docker buildx build --platform linux/arm64 --build-arg tag=22.04 --provenance false --tag ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-ppc64le openmpi-ubuntu-gpu/

docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-20.04-ppc64le
docker push ghcr.io/rse-ops/lammps-matrix:openmpi-ubuntu-gpu-22.04-ppc64le

0 comments on commit e31d66e

Please sign in to comment.