Skip to content

Commit 7f48298

Browse files
committed
actions test
1 parent fc3b247 commit 7f48298

2 files changed

Lines changed: 50 additions & 23 deletions

File tree

.github/workflows/release-reproducible-smart-contract.yaml

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
env:
1111
REGISTRY: docker.io
1212
SERVICE_NAME: 'verifiable-sc'
13+
SOURCE_IMAGE_TAG: 'rust:1.85.0'
1314

1415
jobs:
1516
build-and-push-image:
@@ -20,29 +21,54 @@ jobs:
2021
uses: actions/checkout@v4
2122
with:
2223
submodules: recursive
23-
# Uses the `docker/login-action` action to log in to the Container registry.
24-
- name: Log in to the Container registry
25-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
24+
# - run: |
25+
# rustup update stable
26+
# rustup default stable
27+
# rustup target add wasm32-unknown-unknown
28+
- name: Install Rust
29+
uses: actions-rust-lang/setup-rust-toolchain@v1
2630
with:
27-
registry: ${{ env.REGISTRY }}
28-
username: ${{ secrets.DOCKERHUB_USERNAME }}
29-
password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
toolchain: 1.85.0
32+
#target: wasm32-unknown-unknown
33+
- name: Test smart contract
34+
env:
35+
TAG: ${{ github.ref_name }}
36+
working-directory: ./concordium-base/smart-contracts/rust-contracts/example-contracts/fib
37+
run: |
38+
docker build -f "$GITHUB_WORKSPACE/reproducible/build.Dockerfile" --build-arg source_image="$SOURCE_IMAGE_TAG" -t local-image "$GITHUB_WORKSPACE/reproducible"
39+
cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml"
40+
# cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml" -- concordium build --verifiable "localhost/local-image:latest"
41+
# cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml" -- concordium verify-build --module ./concordium-out/module.wasm.v1 --source ./concordium-out/module.wasm.v1.tar
3042
- name: Extract version from git tag
3143
id: meta
3244
env:
33-
TAG: ${{ github.ref_name }}
45+
TAG: ${{ github.ref_name }}
3446
run: |
35-
SERVICE_TAG=${TAG##${{ env.SERVICE_NAME }}/}
36-
if [ $SERVICE_TAG != ${{ env.SOURCE_IMAGE_TAG }} ]; then
37-
echo "Tag version does not match the source image version."
38-
exit 1
39-
fi
40-
echo "tag=${{ env.REGISTRY }}concordium/${{ env.SERVICE_NAME }}-${SERVICE_TAG}" >> $GITHUB_OUTPUT
41-
- name: Build and push Docker image
42-
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
43-
with:
44-
context: .
45-
file: ./reproducible/build.Dockerfile
46-
push: true
47-
platforms: linux/amd64
48-
tags: ${{ steps.meta.outputs.tag }}
47+
# Extract version by splitting on "/" and taking the second part
48+
TAG_VERSION=$(echo "$TAG" | cut -d '/' -f2)
49+
IMG_VERSION=$(echo "$SOURCE_IMAGE_TAG" | cut -d ':' -f2)
50+
51+
if [ $TAG_VERSION != $IMG_VERSION ]; then
52+
echo "Tag version does not match the source image version."
53+
exit 1
54+
fi
55+
56+
# Save tag as fx "docker.io/concordium/verifiable-sc-1.85.0"
57+
echo "tag=$REGISTRY/concordium/$SERVICE_NAME-$TAG_VERSION" >> $GITHUB_OUTPUT
58+
# Uses the `docker/login-action` action to log in to the Container registry.
59+
# - name: Log in to the Container registry
60+
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
61+
# with:
62+
# registry: ${{ env.REGISTRY }}
63+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
64+
# password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
# - name: Build and push Docker image
66+
# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
67+
# with:
68+
# context: .
69+
# file: ./reproducible/build.Dockerfile
70+
# push: true
71+
# platforms: linux/amd64
72+
# tags: ${{ steps.meta.outputs.tag }}
73+
# build-args: |
74+
# source_image=${{ env.SOURCE_IMAGE_TAG }}

reproducible/build.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# A builder for images for verifiable/reproducible builds.
2-
# The `source_image` is meant to be a published Rust image, such as rust:1.70.
2+
# The `source_image` is meant to be a published Rust image, such as rust:1.90.
33
#
44
# This image only adds a script `run-copy.sh` that is used by cargo-concordium
55
# to copy data in and out of the container. The image also adds
66
# wasm32-unknown-unknown target.
77

8-
FROM rust:1.85 AS build
8+
ARG source_image=rust:1.90.0
9+
FROM ${source_image} AS build
910

1011
RUN rustup target add wasm32-unknown-unknown
1112

0 commit comments

Comments
 (0)