forked from openthread/ot-efr32
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! [actions] upload docker image tar to artifacts
- Loading branch information
Showing
3 changed files
with
39 additions
and
38 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,10 @@ | |
name: Docker | ||
|
||
env: | ||
TEST_TAG: siliconlabsinc/ot-efr32-dev:test | ||
BASE_IMAGE: siliconlabsinc/ot-efr32-dev:base | ||
SHA_TAG: siliconlabsinc/ot-efr32-dev:${{ github.sha }} | ||
LATEST_TAG: siliconlabsinc/ot-efr32-dev:latest | ||
DOCKER_IMAGE_ARTIFACT_NAME: ot-efr32-dev-image-${{ github.sha }}-${{ github.event_name}} | ||
DOCKER_IMAGE_TAR: ot-efr32-dev-image-${{ github.sha }}.tar | ||
DOCKER_IMAGE_ARTIFACT_NAME: ot-efr32-dev-image-${{ github.sha }}-${{ github.event_name}}.tar | ||
|
||
on: | ||
push: | ||
|
@@ -60,38 +59,39 @@ jobs: | |
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- uses: actions/checkout@v4 # v3.3.0 | ||
with: | ||
submodules: true | ||
# - uses: actions/checkout@v4 # v3.3.0 | ||
# with: | ||
# submodules: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
|
||
- name: Build and export to Docker context | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
# load: true | ||
load: true | ||
build-args: | | ||
- BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
platforms: | ||
linux/amd64 | ||
tags: | | ||
${{ env.TEST_TAG }} | ||
${{ env.SHA_TAG }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
outputs: type=oci,dest=${{ env.DOCKER_IMAGE_TAR}} | ||
outputs: type=docker,dest=/tmp/${{ env.DOCKER_IMAGE_ARTIFACT_NAME}} | ||
|
||
# - name: Container image sanity checks | ||
# run: | | ||
# # Download container-structure-test | ||
# curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 \ | ||
# && chmod +x container-structure-test-linux-amd64 | ||
- name: Inspect Docker image | ||
run: docker inspect ${{ env.SHA_TAG }} | ||
|
||
# # Run tests | ||
# ./container-structure-test-linux-amd64 test --config docker/test-ot-efr32-dev.yml --image ${{ env.TEST_TAG }} | ||
- name: Container image sanity checks | ||
run: | | ||
# Download container-structure-test | ||
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 \ | ||
&& chmod +x container-structure-test-linux-amd64 | ||
# Run tests | ||
./container-structure-test-linux-amd64 test --config docker/test-ot-efr32-dev.yml --image ${{ env.SHA_TAG }} | ||
# - name: Create LFS file hash list | ||
# run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | ||
|
@@ -108,13 +108,13 @@ jobs: | |
|
||
# - name: Test build inside container | ||
# run: | | ||
# docker run -v ${{ github.workspace }}:/ot-efr32/ --user $(id -u) --rm ${{ env.TEST_TAG }} script/build --skip-silabs-apps brd4151a | ||
# docker run -v ${{ github.workspace }}:/ot-efr32/ --user $(id -u) --rm ${{ env.SHA_TAG }} script/build --skip-silabs-apps brd4151a | ||
|
||
- name: Upload docker image | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
path: ${{ env.DOCKER_IMAGE_TAR }} | ||
path: /tmp/${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
|
||
publish: | ||
name: Publish to DockerHub | ||
|
@@ -131,36 +131,32 @@ jobs: | |
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Download Docker image | ||
id: download | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
|
||
- name: Show downloaded Docker image | ||
run: ls -ahl ${{ github.workspace }} | ||
path: /tmp | ||
|
||
- name: Load Docker image | ||
run: docker load -i ${{ github.workspace }}/${{ env.DOCKER_IMAGE_TAR }} | ||
run: | | ||
docker load --input ${{ steps.download.outputs.download-path }}/${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
docker image ls -a | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
file: docker/ot-efr32-dev.Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.SHA_TAG }} | ||
tags: ${{ env.SHA_TAG }} | ||
platforms: | ||
linux/amd64 | ||
|
||
- name: Tag `latest` and push | ||
uses: docker/build-push-action@v5 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
file: docker/ot-efr32-dev.Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.LATEST_TAG }} | ||
tags: ${{ env.LATEST_TAG }} | ||
platforms: | ||
linux/amd64 |
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