Skip to content

Commit 5e57493

Browse files
authored
Add simple test to image before uploading (#1)
* Separate build and push steps * Add test step
1 parent b2ea9a1 commit 5e57493

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
required: true
1414
default: "nightly"
1515

16+
env:
17+
IMAGE_NAME: ghcr.io/vita-rust/vitasdk-rs
18+
1619
jobs:
1720
build:
1821
name: Build
@@ -32,15 +35,26 @@ jobs:
3235
id: meta
3336
uses: docker/metadata-action@v4
3437
with:
35-
images: ghcr.io/vita-rust/vitasdk-rs
38+
images: ${{ env.IMAGE_NAME }}
3639
tags: |
3740
type=raw,value=latest
3841
39-
- name: Build and push Docker image to ghcr
42+
- name: Build Docker image
43+
id: build
4044
uses: docker/build-push-action@v4
4145
with:
4246
context: .
43-
push: true
4447
tags: ${{ steps.meta.outputs.tags }}
4548
labels: ${{ steps.meta.outputs.labels }}
4649
build-args: "RUST_TOOLCHAIN=${{ github.event.inputs.rust_toolchain || 'nightly' }}"
50+
51+
- name: Test built image
52+
run: |
53+
docker run \
54+
--mount type=bind,source="$(pwd)"/test.sh,target=/test.sh,readonly \
55+
${{ steps.build.outputs.imageid }} \
56+
/test.sh
57+
58+
- name: Push image to ghcr
59+
run: |
60+
docker push --all-tags ${{ env.IMAGE_NAME }}

test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
set -e
3+
4+
cd /tmp
5+
6+
cat > "test.rs" << EOF
7+
fn main() {}
8+
EOF
9+
10+
cargo +nightly build --target armv7-sony-vita-newlibeabihf -Zbuild-std -Zscript --manifest-path test.rs

0 commit comments

Comments
 (0)