Skip to content

Commit

Permalink
Add simple test to image before uploading (#1)
Browse files Browse the repository at this point in the history
* Separate build and push steps

* Add test step
  • Loading branch information
pheki authored Jan 16, 2024
1 parent b2ea9a1 commit 5e57493
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
required: true
default: "nightly"

env:
IMAGE_NAME: ghcr.io/vita-rust/vitasdk-rs

jobs:
build:
name: Build
Expand All @@ -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 }}
10 changes: 10 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5e57493

Please sign in to comment.