Skip to content

Commit 8e2e5db

Browse files
authored
Merge pull request #3 from paritytech/main
Merge latest changes to CI from upstream Parity repo
2 parents 6e7f232 + f8c5f05 commit 8e2e5db

File tree

4 files changed

+180
-193
lines changed

4 files changed

+180
-193
lines changed

.github/workflows/ci.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
# common variable is defined in the workflow
17+
# repo env variable doesn't work for PR from forks
18+
env:
19+
CI_IMAGE: "paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240222"
20+
21+
jobs:
22+
set-image:
23+
# This workaround sets the container image for each job using 'set-image' job output.
24+
# env variables don't work for PR from forks, so we need to use outputs.
25+
runs-on: ubuntu-latest
26+
outputs:
27+
CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }}
28+
steps:
29+
- id: set_image
30+
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT
31+
32+
fmt:
33+
name: Cargo fmt
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 5
36+
needs: [set-image]
37+
container:
38+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
39+
steps:
40+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
41+
- name: Rust Cache
42+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
43+
with:
44+
cache-on-failure: true
45+
cache-all-crates: true
46+
- name: cargo info
47+
run: |
48+
echo "######## rustup show ########"
49+
rustup show
50+
echo "######## cargo --version ########"
51+
cargo --version
52+
- name: Cargo fmt
53+
run: cargo +nightly fmt --all -- --check
54+
55+
build-test-linux:
56+
name: Build Linux
57+
runs-on: parity-large
58+
timeout-minutes: 50
59+
needs: [set-image, fmt]
60+
container:
61+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
62+
steps:
63+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
64+
- name: Rust Cache
65+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
66+
with:
67+
cache-on-failure: true
68+
cache-all-crates: true
69+
- name: cargo info
70+
run: |
71+
echo "######## rustup show ########"
72+
rustup show
73+
echo "######## cargo --version ########"
74+
cargo --version
75+
- name: Build and Test Linux
76+
run: |
77+
echo "######## cargo build ########"
78+
cargo build --release
79+
echo "######## cargo test ########"
80+
cargo test --release --all
81+
echo "######## Packing artifacts ########"
82+
mkdir -p ./artifacts/substrate-contracts-node-linux/
83+
cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node
84+
ls -la ./artifacts/substrate-contracts-node-linux/
85+
- name: Upload artifacts
86+
uses: actions/upload-artifact@v4.3.6
87+
with:
88+
name: build-linux
89+
path: ./artifacts
90+
build-macos:
91+
timeout-minutes: 50
92+
runs-on: parity-macos
93+
needs: [fmt]
94+
steps:
95+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
96+
- name: Set rust version from env file
97+
run: |
98+
echo $CI_IMAGE
99+
RUST_VERSION=$(echo $CI_IMAGE | sed -E 's/.*ci-unified:([^-]+)-([^-]+).*/\2/')
100+
echo $RUST_VERSION
101+
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
102+
- name: Set up Homebrew
103+
uses: Homebrew/actions/setup-homebrew@1ccc07ccd54b6048295516a3eb89b192c35057dc # master from 12.09.2024
104+
- name: Install protobuf
105+
run: brew install protobuf
106+
- name: Install rust ${{ env.RUST_VERSION }}
107+
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
108+
with:
109+
cache: false
110+
toolchain: ${{ env.RUST_VERSION }}
111+
target: wasm32-unknown-unknown, aarch64-apple-darwin, x86_64-apple-darwin
112+
components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std
113+
- name: cargo info
114+
run: |
115+
echo "######## rustup show ########"
116+
rustup show
117+
echo "######## cargo --version ########"
118+
cargo --version
119+
- name: Rust Cache
120+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
121+
with:
122+
cache-on-failure: true
123+
cache-all-crates: true
124+
- name: Run cargo build
125+
run: |
126+
echo "######## cargo build aarch64-apple-darwin ########"
127+
cargo build --release --target aarch64-apple-darwin
128+
echo "######## cargo build x86_64-apple-darwin ########"
129+
cargo build --release --target x86_64-apple-darwin
130+
echo "######## Packing artifacts ########"
131+
mkdir -p ./artifacts/substrate-contracts-node-mac/
132+
lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \
133+
./target/aarch64-apple-darwin/release/substrate-contracts-node \
134+
-create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node
135+
ls -la ./artifacts/substrate-contracts-node-mac/
136+
- name: Upload artifacts
137+
uses: actions/upload-artifact@v4.3.6
138+
with:
139+
name: build-macos
140+
path: ./artifacts
141+
publish:
142+
name: Publish release
143+
runs-on: ubuntu-latest
144+
needs: [build-test-linux, build-macos]
145+
permissions:
146+
contents: write
147+
steps:
148+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
149+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
150+
with:
151+
name: build-linux
152+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
153+
with:
154+
name: build-macos
155+
- name: Pack artifacts
156+
run: |
157+
tar -czvf ./substrate-contracts-node-linux.tar.gz ./substrate-contracts-node-linux
158+
tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./substrate-contracts-node-mac
159+
ls -la
160+
- name: Publish release
161+
uses: ghalactic/github-release-from-tag@cebdacac0ccd08933b8e7f278f4123723ad978eb # v5.4.0
162+
if: github.ref_type == 'tag'
163+
with:
164+
prerelease: false
165+
draft: true
166+
assets: |
167+
- path: substrate-contracts-node-linux.tar.gz
168+
- path: substrate-contracts-node-mac-universal.tar.gz

.github/workflows/gitspiegel-trigger.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitlab-ci.yml

Lines changed: 0 additions & 165 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,18 @@ We can have two types of releases:
109109
`cargo release 0.XX.0 -v --no-tag --no-push -p contracts-node --execute`
110110
Note: Before uploading, perform a dry run to ensure that it will be successful.
111111
- [ ] Merge the release PR branch.
112-
- [ ] Replace `XX` in this command with your incremented version number and execute it:
113-
`git checkout main && git pull && git tag v0.XX.0 && git push origin v0.XX.0`.
114-
This will push a new tag with the version number to this repository.
115-
- [ ] We have set this repository up in a way that tags à la `vX.X.X` trigger
116-
a CI run that creates a GitHub draft release. You can observe CI runs on
117-
[GitLab](https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/pipelines).
112+
- [ ] Set the tag and run the following commands to push the tag. The tag must contain a message, otherwise the github action won't be able to create a release:
113+
114+
```bash
115+
TAG="v0.XX.0"
116+
git checkout main
117+
git pull
118+
git tag -a ${TAG} -m "${TAG}"
119+
git push origin ${TAG}
120+
```
121+
122+
123+
- [ ] After tag is pushed CI creates a GitHub draft release.
118124
This draft release will contain a binary for Linux and Mac and appear
119125
under [Releases](https://github.com/paritytech/substrate-contracts-node/releases).
120126
Add a description in the style of "Synchronized with [`polkadot-v1.8.0`](https://github.com/paritytech/polkadot-sdk/tree/release-polkadot-v1.8.0) branch."

0 commit comments

Comments
 (0)