Skip to content

Commit

Permalink
Define separate test and push steps
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Apr 3, 2024
1 parent 0813b2a commit 199712e
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions .github/workflows/imagebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,31 @@ jobs:
docker buildx use mybuilder
docker buildx inspect --bootstrap
- name: Build and push base Dockerfile
id: basebuild
- name: Build and export base image to Docker
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: ./dockerfiles/${{ env.BASE_IMAGE_NAME }}
push: true
load: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ env.BASE_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
- name: Test base image
if: steps.basebuild.outcome == 'success'
run: |
# docker run -v ${{ github.workspace }}:/tmp/georust -e CARGO_TARGET_DIR=/tmp/cargo-target -w /tmp/georust/geo georust/${{ env.BASE_IMAGE_NAME }}:${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }} /bin/bash -c "cargo test"
- name: Upload Image to artifact cache
if: steps.basebuild.outcome == 'success'
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ env.BASE_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
path: /tmp/${{ env.BASE_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar

# docker run --rm ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
- name: Push tested multi-platform base image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: ./dockerfiles/${{ env.BASE_IMAGE_NAME }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ env.BASE_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
build_dependent_images:
name: Build dependent images for geo and proj
Expand Down Expand Up @@ -111,22 +110,25 @@ jobs:
- name: Build ${{ matrix.docker_image_name }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: ./dockerfiles/${{ matrix.docker_image_name }}
push: true
load: true
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.docker_image_name }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
- name: Test ${{ matrix.docker_image_name }} image
- name: Test ${{ matrix.docker_image_name }}
run: |
# docker run -v ${{ github.workspace }}:/tmp/georust -e CARGO_TARGET_DIR=/tmp/cargo-target -w /tmp/georust/geo georust/geo-ci:${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }} /bin/bash -c "cargo test"
- name: Upload Image to artifact cache
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ matrix.docker_image_name }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
path: /tmp/${{ matrix.docker_image_name }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
# docker run --rm ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
- name: Push tested multi-platform ${{ matrix.docker_image_name }} image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: ./dockerfiles/${{ matrix.docker_image_name }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.docker_image_name }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}

0 comments on commit 199712e

Please sign in to comment.