Skip to content

Commit

Permalink
Fix env in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain committed May 16, 2024
1 parent b202af0 commit 8b4a8bb
Showing 1 changed file with 176 additions and 175 deletions.
351 changes: 176 additions & 175 deletions .github/workflows/build-fuzzy.yml
Original file line number Diff line number Diff line change
@@ -1,176 +1,177 @@
---
name: Build Fuzzy Environments

on:
push:
branches: ['*']
pull_request:
branches: ['*']

env:
VERIFICARLO_VERSION: v2.0.0

jobs:
fuzzy:
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: Dockerfile
strategy:
max-parallel: 1
matrix:
include:
- NAME: Lapack + Libmath
DOCKER_FROM: ""
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath

- NAME: Python
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python

- NAME: Numpy
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy

- NAME: Scipy
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy

- NAME: Scikit-Learn
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn

name: ${{ matrix.NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes

- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}

- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
continue-on-error: true
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ matrix.DOCKER_FROM }}
path: /tmp

- name: (optionally) Load, Build, and (optionally) Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if [ ! -z ${{ matrix.DOCKER_FROM }} ]
then
docker load --input /tmp/${{ matrix.DOCKER_FROM }}.tar
---
name: Build Fuzzy Environments

on:
push:
branches: ['*']
pull_request:
branches: ['*']

env:
VERIFICARLO_VERSION: v2.0.0

jobs:
fuzzy:
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: Dockerfile
VERIFICARLO_VERSION: ${{ env.VERIFICARLO_VERSION }}
strategy:
max-parallel: 1
matrix:
include:
- NAME: Lapack + Libmath
DOCKER_FROM: ""
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-0-lapack-libmath

- NAME: Python
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-1-python

- NAME: Numpy
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-2-numpy

- NAME: Scipy
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-3-scipy

- NAME: Scikit-Learn
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy
DOCKER_TO: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy:${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_FILE: ./docker/base/ubuntu-20.04/Dockerfile.ubuntu-20.04-4-sklearn

name: ${{ matrix.NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes

- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}

- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
continue-on-error: true
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ matrix.DOCKER_FROM }}
path: /tmp

- name: (optionally) Load, Build, and (optionally) Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if [ ! -z ${{ matrix.DOCKER_FROM }} ]
then
docker load --input /tmp/${{ matrix.DOCKER_FROM }}.tar
docker image ls -a
fi
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
-f ${{ matrix.DOCKER_FILE }} \
--build-arg VERIFICARLO_VERSION=${{ env.VERIFICARLO_VERSION }}
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
if ${{ env.PUSH }}
then
docker push ${{ matrix.DOCKER_IMAGE }}
fi
- name: Upload Docker artifacts
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.DOCKER_TO }}
path: /tmp/${{ matrix.DOCKER_TO }}.tar

rename-publish:
needs: fuzzy
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: docker
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy
DOCKER_FROM_TAG: ${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes

- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}

- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ env.DOCKER_FROM }}
path: /tmp

- name: (optionally) Load, Rename, and Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
docker load --input /tmp/${{ env.DOCKER_FROM }}.tar
docker image ls -a
fi
docker build ./ -t ${{ matrix.DOCKER_IMAGE }} \
-f ${{ matrix.DOCKER_FILE }} \
--build-arg VERIFICARLO_VERSION=${{ env.VERIFICARLO_VERSION }}
docker save ${{ matrix.DOCKER_IMAGE }} -o /tmp/${{ matrix.DOCKER_TO }}.tar
if ${{ env.PUSH }}
then
docker push ${{ matrix.DOCKER_IMAGE }}
fi
- name: Upload Docker artifacts
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.DOCKER_TO }}
path: /tmp/${{ matrix.DOCKER_TO }}.tar

rename-publish:
needs: fuzzy
runs-on: ubuntu-20.04
env:
RUN_IF_CHANGED: docker
DOCKER_FROM: fuzzy_${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn
DOCKER_IMAGE: verificarlo/fuzzy
DOCKER_FROM_TAG: ${{ env.VERIFICARLO_VERSION }}-lapack-python3.8.5-numpy-scipy-sklearn

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for file changes
uses: jitterbit/get-changed-files@v1
id: changes

- name: Print list of changed files
run: echo ${{ steps.changes.outputs.all }}

- name: If Dockerfiles have been updated, cancel running upstream jobs
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Determine if images will be pushed to Docker, and login as needed
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
if ([ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/master" ])
then
echo This is a push to master: we will push to Docker Hub
echo "PUSH=true" >> "$GITHUB_ENV"
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
else
echo This is a PR or non-master push: we will not push to Docker Hub
echo "PUSH=false" >> "$GITHUB_ENV"
fi
- name: Download Docker artifacts, if available
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
uses: actions/download-artifact@v2
with:
name: ${{ env.DOCKER_FROM }}
path: /tmp

- name: (optionally) Load, Rename, and Push Docker image
if: contains(steps.changes.outputs.all, ${{ env.RUN_IF_CHANGED }})
run: |
docker load --input /tmp/${{ env.DOCKER_FROM }}.tar
docker image ls -a
docker image tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_FROM_TAG }} \
${{ env.DOCKER_IMAGE }}:latest
if ${{ env.PUSH }}
then
docker push ${{ env.DOCKER_IMAGE }}:latest
fi
docker image tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_FROM_TAG }} \
${{ env.DOCKER_IMAGE }}:latest
if ${{ env.PUSH }}
then
docker push ${{ env.DOCKER_IMAGE }}:latest
fi

0 comments on commit 8b4a8bb

Please sign in to comment.