99
1010jobs :
1111 set-tags :
12- runs-on : ubuntu-22 .04
12+ runs-on : ubuntu-24 .04
1313 outputs :
1414 image_exists : ${{ steps.check-docker-image.outputs.image_exists }}
1515 git_ref : ${{ steps.check-git-ref.outputs.git_ref }}
@@ -18,106 +18,77 @@ jobs:
1818 latest_rt : ${{ steps.get-sha.outputs.latest_rt }}
1919 latest_rt_sha8 : ${{ steps.get-sha.outputs.latest_rt_sha8 }}
2020 steps :
21- - name : Check git ref
22- id : check-git-ref
23- # if PR
24- # else if manual PR
25- # else (push)
26- run : |
27- if [[ -n "${{ github.event.pull_request.head.sha }}" ]]; then
28- echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
29- echo "git_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
30- elif [[ -n "${{ github.event.inputs.pull_request }}" ]]; then
31- echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
32- echo "git_ref=refs/pull/${{ github.event.inputs.pull_request }}/head" >> $GITHUB_OUTPUT
33- else
34- echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
35- echo "git_ref=$GITHUB_REF" >> $GITHUB_OUTPUT
36- fi
37- - name : Checkout
38- uses : actions/checkout@v3
39- with :
40- ref : ${{ steps.check-git-ref.outputs.git_ref }}
41- - name : Get Latest RT Release
42- id : get-latest-rt
43- run : |
44- LATEST_RUNTIME_RELEASE=$(curl -s https://api.github.com/repos/moondance-labs/tanssi/releases | jq -r '.[] | select(.name | test("runtime";"i")) | .tag_name' | head -n 1 | tr -d '[:blank:]') && [[ ! -z "${LATEST_RUNTIME_RELEASE}" ]]
45- echo $LATEST_RUNTIME_RELEASE
46- echo "latest_rt=$LATEST_RUNTIME_RELEASE" >> $GITHUB_OUTPUT
47- - name : Get Sha
48- id : get-sha
49- run : |
50- echo "sha=$(git log -1 --format='%H')" >> $GITHUB_OUTPUT
51- echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT
52-
53- ENDPOINT="https://api.github.com/repos/moondance-labs/tanssi/git/refs/tags/${{ steps.get-latest-rt.outputs.latest_rt }}"
54- RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" $ENDPOINT)
55- TYPE=$(echo $RESPONSE | jq -r '.object.type')
56-
57- if [[ $TYPE == "commit" ]]
58- then
59- LATEST_RT_SHA8=$(echo $RESPONSE | jq -r '.object.sha' | cut -c -8)
60- elif [[ $TYPE == "tag" ]]
61- then
62- URL=$(echo $RESPONSE | jq -r '.object.url')
63- TAG_RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" $URL)
64- TAG_RESPONSE_CLEAN=$(echo $TAG_RESPONSE | tr -d '\000-\037')
65- LATEST_RT_SHA8=$(echo $TAG_RESPONSE_CLEAN | jq -r '.object.sha' | cut -c -8)
66- fi
67-
68- echo $LATEST_RT_SHA8
69- echo "latest_rt_sha8=$LATEST_RT_SHA8" >> $GITHUB_OUTPUT
70-
71- - name : Check existing docker image
72- id : check-docker-image
73- run : |
74- TAG=sha-${{ steps.get-sha.outputs.sha8 }}
75- echo "image_exists=$(docker image inspect moondancelabs/tanssi:$TAG > /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT
76-
77- - name : Display variables
78- run : |
79- echo git_ref: ${{ steps.check-git-ref.outputs.git_ref }}
80- echo sha: ${{ steps.get-sha.outputs.sha }}
81- echo sha8: ${{ steps.get-sha.outputs.sha8 }}
82- echo image_exists: ${{ steps.check-docker-image.outputs.image_exists }}
83- echo latest_rt: ${{ steps.get-latest-rt.outputs.latest_rt }}
84- echo latest_rt_sha8: ${{ steps.get-sha.outputs.latest_rt_sha8 }}
21+ - name : Check git ref
22+ id : check-git-ref
23+ # if PR
24+ # else if manual PR
25+ # else (push)
26+ run : |
27+ if [[ -n "${{ github.event.pull_request.head.sha }}" ]]; then
28+ echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
29+ echo "git_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
30+ elif [[ -n "${{ github.event.inputs.pull_request }}" ]]; then
31+ echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
32+ echo "git_ref=refs/pull/${{ github.event.inputs.pull_request }}/head" >> $GITHUB_OUTPUT
33+ else
34+ echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
35+ echo "git_ref=$GITHUB_REF" >> $GITHUB_OUTPUT
36+ fi
37+ - name : Checkout
38+ uses : actions/checkout@v6
39+ with :
40+ ref : ${{ steps.check-git-ref.outputs.git_ref }}
41+ - name : Get Sha
42+ id : get-sha
43+ run : |
44+ echo "sha=$(git log -1 --format='%H')" >> $GITHUB_OUTPUT
45+ echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT
46+ - name : Check existing docker image
47+ id : check-docker-image
48+ run : |
49+ TAG=sha-${{ steps.get-sha.outputs.sha8 }}
50+ echo "image_exists=$(docker image inspect moondancelabs/tanssi:$TAG > /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT
51+ - name : Display variables
52+ run : |
53+ echo git_ref: ${{ steps.check-git-ref.outputs.git_ref }}
54+ echo sha: ${{ steps.get-sha.outputs.sha }}
55+ echo sha8: ${{ steps.get-sha.outputs.sha8 }}
8556
8657 # ###### Static Analyses #######
8758 cargo-clippy :
88- runs-on : ubuntu-22.04
89- needs : ["set-tags"]
59+ runs-on : ubuntu-24.04
60+ needs : [ "set-tags", "build" ]
61+ env :
62+ RUSTC_WRAPPER : " sccache"
63+ CARGO_INCREMENTAL : " 0"
64+ SCCACHE_CACHE_SIZE : " 100GB"
65+ SCCACHE_GHA_ENABLED : " true"
9066 steps :
9167 - name : Checkout
92- uses : actions/checkout@v3
68+ uses : actions/checkout@v6
9369 with :
9470 ref : ${{ needs.set-tags.outputs.git_ref }}
95-
9671 - name : Setup Rust toolchain
9772 run : rustup show
98-
9973 - name : Checkout tanssi repo
10074 run : |
10175 cd ..
10276 git clone --depth 1 https://github.com/moondance-labs/tanssi
10377 cd -
104-
10578 - name : Install protoc
10679 run : |
10780 sudo apt-get update
10881 sudo apt-get install -y protobuf-compiler
109-
11082 - name : Clippy
11183 run : |
112- cd fuzz
11384 SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --all-targets --locked --workspace
11485
11586 toml-formatting :
116- runs-on : ubuntu-22 .04
87+ runs-on : ubuntu-24 .04
11788 needs : ["set-tags"]
11889 steps :
11990 - name : Checkout
120- uses : actions/checkout@v3
91+ uses : actions/checkout@v6
12192 with :
12293 ref : ${{ needs.set-tags.outputs.git_ref }}
12394
@@ -133,14 +104,11 @@ jobs:
133104 # ###### Building and Testing binaries #######
134105
135106 build :
136- runs-on : ubuntu-22 .04
107+ runs-on : ubuntu-24 .04
137108 needs : ["set-tags"]
138- env :
139- TMP_TARGET : " /tmp/target"
140- CARGO_TARGET_DIR : " target"
141109 steps :
142110 - name : Checkout
143- uses : actions/checkout@v3
111+ uses : actions/checkout@v6
144112 with :
145113 ref : ${{ needs.set-tags.outputs.git_ref }}
146114 - name : Run sccache-cache
@@ -184,58 +152,3 @@ jobs:
184152 with :
185153 name : binaries
186154 path : binaries
187-
188- docker-tanssi :
189- runs-on : ubuntu-22.04
190- needs : ["set-tags", "build"]
191- strategy :
192- matrix :
193- image : ["tanssi", "container-chain-simple-template", "container-chain-evm-template"]
194- if : ${{ (needs.set-tags.outputs.image_exists == 'false') && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push') }}
195- steps :
196- - name : Checkout
197- uses : actions/checkout@v3
198- with :
199- ref : ${{ needs.set-tags.outputs.git_ref }}
200- - uses : actions/download-artifact@v4
201- with :
202- name : binaries
203- path : build
204- merge-multiple : true
205- - name : Prepare
206- id : prep
207- run : |
208- DOCKER_IMAGE=moondancelabs/${{matrix.image}}
209- TAGS="${DOCKER_IMAGE}:sha-${{ needs.set-tags.outputs.sha8 }}"
210- echo "tags=${TAGS}" >> $GITHUB_OUTPUT
211- echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
212- - name : Set up QEMU
213- uses : docker/setup-qemu-action@v2.1.0
214- - name : Set up Docker Buildx
215- uses : docker/setup-buildx-action@v2.5.0
216- with :
217- version : latest
218- driver-opts : |
219- image=moby/buildkit:master
220- - name : Login to DockerHub
221- uses : docker/login-action@v2.2.0
222- with :
223- username : ${{ secrets.DOCKERHUB_USERNAME }}
224- password : ${{ secrets.DOCKERHUB_TOKEN }}
225- - name : Build and push
226- id : docker_build
227- uses : docker/build-push-action@v4
228- with :
229- context : .
230- file : ./docker/${{matrix.image}}.Dockerfile
231- platforms : linux/amd64
232- push : true
233- tags : ${{ steps.prep.outputs.tags }}
234- labels : |
235- org.opencontainers.image.title=${{ github.event.repository.name }}
236- org.opencontainers.image.description=${{ github.event.repository.description }}
237- org.opencontainers.image.url=${{ github.event.repository.html_url }}
238- org.opencontainers.image.source=${{ github.event.repository.clone_url }}
239- org.opencontainers.image.created=${{ steps.prep.outputs.created }}
240- org.opencontainers.image.revision=${{ github.sha }}
241- org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
0 commit comments