Skip to content

Commit

Permalink
Build and push images with linux/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
oshadura committed Jan 10, 2025
1 parent e4b550a commit 80bc309
Showing 1 changed file with 158 additions and 155 deletions.
313 changes: 158 additions & 155 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ env:
releasev0: "0.7.24"

jobs:

matrix-build:
strategy:
fail-fast: false
Expand All @@ -44,161 +43,165 @@ jobs:
contents: read
packages: write
steps:

- name: Check out code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker

- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKERHUB_ACCOUNT }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Harbor Hub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: hub.opensciencegrid.org
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}

- name: Generate tags
id: tags
env:
image_dir: ${{ matrix.image_dir }}
python: ${{ matrix.python }}
distro: ${{ matrix.distro }}
releasev0: ${{ env.releasev0 }}
release: ${{ env.release }}
python_latest: ${{ env.python_latest}}
stable: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
image="coffeateam/${image_dir}-${distro}"
image_default="coffeateam/${image_dir}"
# release tag or in case other case make it dev
if [ "$stable" == "true" ]; then
if [ ${image_dir} == 'coffea-base' ]; then
tag="${image}:${releasev0}-py${python}"
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker
uses: docker/setup-docker-action@v4
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKERHUB_ACCOUNT }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Harbor Hub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: hub.opensciencegrid.org
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}

- name: Generate tags
id: tags
env:
image_dir: ${{ matrix.image_dir }}
python: ${{ matrix.python }}
distro: ${{ matrix.distro }}
releasev0: ${{ env.releasev0 }}
release: ${{ env.release }}
python_latest: ${{ env.python_latest}}
stable: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
image="coffeateam/${image_dir}-${distro}"
image_default="coffeateam/${image_dir}"
# release tag or in case other case make it dev
if [ "$stable" == "true" ]; then
if [ ${image_dir} == 'coffea-base' ]; then
tag="${image}:${releasev0}-py${python}"
else
tag="${image}:${release}-py${python}"
fi
tags=${image}:latest-py${python},$tag
# latest tag
if [ ${python} == ${python_latest} ] || [ "$python" == ${python_latestv0} ]; then
tags=${image}:latest,$tags
fi
else
tag="${image}:${release}-py${python}"
fi
tags=${image}:latest-py${python},$tag
# latest tag
if [ ${python} == ${python_latest} ] || [ "$python" == ${python_latestv0} ]; then
tags=${image}:latest,$tags
tag="${image}:dev-py${python}"
tags=$tag
if [ "$python" == ${python_latest} ] || [ "$python" == ${python_latestv0} ]; then
tags=${image}:dev,$tags
fi
fi
else
tag="${image}:dev-py${python}"
tags=$tag
if [ "$python" == ${python_latest} ] || [ "$python" == ${python_latestv0} ]; then
tags=${image}:dev,$tags
echo "::set-output name=tag::${tag}"
echo "::set-output name=tags::${tags}"
- name: Build base v0
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}
- name: Build base v1
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Test Conda environement
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm ${tag} conda list --export
- name: Make sure voms tools are working
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
ERROR=$(docker run ${tag} voms-proxy-info 2>&1 > /dev/null; exit 0)
TEST=$(echo -e "\nCouldn't find a valid proxy.\n")
if [ "$ERROR" == "$TEST" ]; then
exit 0
else
exit 1
fi
fi
echo "::set-output name=tag::${tag}"
echo "::set-output name=tags::${tags}"
- name: Build base v0
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}
- name: Build base v1
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Test Conda environement
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm ${tag} conda list --export
- name: Make sure voms tools are working
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
ERROR=$(docker run ${tag} voms-proxy-info 2>&1 > /dev/null; exit 0)
TEST=$(echo -e "\nCouldn't find a valid proxy.\n")
if [ "$ERROR" == "$TEST" ]; then
exit 0
else
exit 1
fi
- name: Test Pytest environement v0
if: ${{ matrix.image_dir == 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m v0"
- name: Test Pytest environement CalVer
if: ${{ matrix.image_dir != 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m calver"
- name: Build and push v0
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Build and push v1
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}
- name: Test Pytest environement v0
if: ${{ matrix.image_dir == 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m v0"
- name: Test Pytest environement CalVer
if: ${{ matrix.image_dir != 'coffea-base' }}
env:
tag: ${{ steps.tags.outputs.tag }}
run: |
docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \
sh -c "pip install -U pytest && cd tmp/workspace && pytest -m calver"
- name: Build and push v0
if: ${{ matrix.image_dir != 'coffea-base' }}
uses: build-push-action@v5
with:
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
platforms: linux/amd64,linux/arm64
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Build and push v1
if: ${{ matrix.image_dir == 'coffea-base' }}
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.tags.outputs.tags }}
context: ${{ matrix.image_dir }}
platforms: linux/amd64,linux/arm64
file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }}
build-args: |
python=${{ matrix.python }}
releasev0=${{ env.releasev0 }}

0 comments on commit 80bc309

Please sign in to comment.