Skip to content

Commit

Permalink
Try artifact pushing to share image across jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
vasrem committed Dec 20, 2023
1 parent 042b4ba commit 14dd02f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,37 @@ jobs:
IMAGE: build-image
IMAGE_TAG: "${{ github.sha }}"
BUILDIMAGE: "build-image:${{ github.sha }}"
BUILDIMAGE_ARTIFACT: "build-image.tar.gz"
steps:
- uses: actions/checkout@v4
- name: build-dev-image
run: make .build-image
- name: export-image-to-targz
run: docker save ${BUILDIMAGE} | gzip > /tmp/${BUILDIMAGE_ARTIFACT}
- name: upload-image
uses: actions/upload-artifact@v4
with:
name: image
path: /tmp/${{ env.BUILDIMAGE_ARTIFACT }}
- name: return-image-name
run: echo "image=${BUILDIMAGE}" >> "${GITHUB_OUTPUT}"
run: |
echo "image=${BUILDIMAGE}" >> "${GITHUB_OUTPUT}"
echo "imageArtifact=${BUILDIMAGE_ARTIFACT}" >> "${GITHUB_OUTPUT}"
outputs:
image: ${{ steps.return-image-name.outputs.image }}
imageArtifact: ${{ steps.return-image-name.outputs.imageArtifact }}
go-checks:
needs: build-dev-image
runs-on: ubuntu-22.04
container:
image: ${{needs.build-dev-image.outputs.image}}
container: ${{needs.build-dev-image.outputs.image}}
steps:
- name: download-image
uses: actions/download-artifact@v4
with:
name: image
path: /tmp
- name: load-image
run: docker load -i /tmp/${{needs.build-dev-image.outputs.imageArtifact}}
- uses: actions/checkout@v4
- name: fmt
run: make assert-fmt
Expand All @@ -50,17 +67,15 @@ jobs:
go-build:
needs: go-checks
runs-on: ubuntu-22.04
container:
image: ${{needs.build-dev-image.outputs.image}}
container: ${{needs.build-dev-image.outputs.image}}
steps:
- uses: actions/checkout@v4
- name: build
run: make build
unit-tests:
needs: go-build
runs-on: ubuntu-22.04
container:
image: ${{needs.build-dev-image.outputs.image}}
container: ${{needs.build-dev-image.outputs.image}}
steps:
- uses: actions/checkout@v4
- name: unit-tests
Expand Down

0 comments on commit 14dd02f

Please sign in to comment.