add nekbone build #31
Workflow file for this run
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: 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"], | |
["nekbone", "ghcr.io/converged-computing/metric-nekbone:latest"], | |
["lammps", "ghcr.io/converged-computing/metric-lammps: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: 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 | |
done | |
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} | |