From 5e57493fb2b2547ec60cf6cf64e40568add0a1e2 Mon Sep 17 00:00:00 2001 From: Aphek Date: Tue, 16 Jan 2024 03:51:01 -0300 Subject: [PATCH] Add simple test to image before uploading (#1) * Separate build and push steps * Add test step --- .github/workflows/build.yml | 20 +++++++++++++++++--- test.sh | 10 ++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9adf8c2..11df2ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,9 @@ on: required: true default: "nightly" +env: + IMAGE_NAME: ghcr.io/vita-rust/vitasdk-rs + jobs: build: name: Build @@ -32,15 +35,26 @@ jobs: id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/vita-rust/vitasdk-rs + images: ${{ env.IMAGE_NAME }} tags: | type=raw,value=latest - - name: Build and push Docker image to ghcr + - name: Build Docker image + id: build uses: docker/build-push-action@v4 with: context: . - push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: "RUST_TOOLCHAIN=${{ github.event.inputs.rust_toolchain || 'nightly' }}" + + - name: Test built image + run: | + docker run \ + --mount type=bind,source="$(pwd)"/test.sh,target=/test.sh,readonly \ + ${{ steps.build.outputs.imageid }} \ + /test.sh + + - name: Push image to ghcr + run: | + docker push --all-tags ${{ env.IMAGE_NAME }} diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..2f469cd --- /dev/null +++ b/test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +cd /tmp + +cat > "test.rs" << EOF +fn main() {} +EOF + +cargo +nightly build --target armv7-sony-vita-newlibeabihf -Zbuild-std -Zscript --manifest-path test.rs