Skip to content

Commit 2004afb

Browse files
authored
Pin Rust version to 1.77.2 for bottlenose (#994)
Changes: - Move GH environment setup to shared action - Pin Rust version to `1.77.2` (as in radixdlt-scrypto `release/botllenose` branch)
2 parents b69b394 + 47fcd77 commit 2004afb

File tree

2 files changed

+52
-46
lines changed

2 files changed

+52
-46
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Setup build environment'
2+
description: 'Common GH action to setup job environment'
3+
inputs:
4+
cross-compile-to-windows:
5+
description: "If 'true' then do some additional build environment setup"
6+
required: false
7+
default: "false" # or "true"
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Install Rust toolchain
13+
uses: RDXWorks-actions/toolchain@master
14+
with:
15+
# IMPORTANT: This version should match the version in radixdlt-scrypto on respective branch
16+
toolchain: stable
17+
default: true
18+
target: ${{inputs.cross-compile-to-windows == 'true' && 'x86_64-pc-windows-msvc' || ''}}
19+
20+
- name: Set up JDK 17
21+
if: ${{ inputs.cross-compile-to-windows == 'false' }}
22+
uses: RDXWorks-actions/setup-java@main
23+
with:
24+
distribution: 'zulu'
25+
java-version: '17'
26+
27+
- name: Install libclang-dev
28+
if: ${{ inputs.cross-compile-to-windows == 'false' }}
29+
run: sudo apt-get update -y && sudo apt-get install -y libclang-dev
30+
shell: bash
31+
32+
## Steps for cross-compilation to Windows
33+
- name: Update clang version to 17
34+
if: ${{ inputs.cross-compile-to-windows == 'true' }}
35+
run: sudo apt remove clang-14 && sudo apt autoclean && sudo apt autoremove && wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 17 && sudo ls /usr/bin/ | grep clang && sudo ln -sf /usr/bin/clang-17 /usr/bin/clang && sudo ln -sf /usr/bin/clang++-17 /usr/bin/clang++ && sudo apt-get install -y libclang-dev llvm llvm-dev
36+
shell: bash
37+
- name: Install cargo-xwin
38+
if: ${{ inputs.cross-compile-to-windows == 'true' }}
39+
run: cargo install cargo-xwin --version 0.17.1 --locked
40+
shell: bash

.github/workflows/ci.yml

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,8 @@ jobs:
109109
with:
110110
# Shallow clones should be disabled for a better relevancy of analysis
111111
fetch-depth: 0
112-
- uses: RDXWorks-actions/rust-toolchain@master
113-
with:
114-
toolchain: stable
115-
- name: Set up JDK 17
116-
uses: RDXWorks-actions/setup-java@main
117-
with:
118-
distribution: 'zulu'
119-
java-version: '17'
120-
- name: Install libclang-dev
121-
run: sudo apt-get update -y && sudo apt-get install -y libclang-dev
112+
- name: Setup environment
113+
uses: ./.github/actions/setup-env
122114
- name: Cache SonarCloud packages
123115
uses: RDXWorks-actions/cache@main
124116
with:
@@ -148,7 +140,7 @@ jobs:
148140
name: distZip
149141
retention-days: 7
150142
- uses: ./.github/actions/fetch-secrets
151-
with:
143+
with:
152144
role_name: "${{ secrets.COMMON_SECRETS_ROLE_ARN }}"
153145
app_name: "babylon-node"
154146
step_name: "build"
@@ -169,14 +161,8 @@ jobs:
169161
with:
170162
# Shallow clones should be disabled for a better relevancy of analysis
171163
fetch-depth: 0
172-
- uses: RDXWorks-actions/rust-toolchain@master
173-
with:
174-
toolchain: stable
175-
- name: Set up JDK 17
176-
uses: RDXWorks-actions/setup-java@main
177-
with:
178-
distribution: 'zulu'
179-
java-version: '17'
164+
- name: Setup environment
165+
uses: ./.github/actions/setup-env
180166
- name: Cache Gradle packages
181167
uses: RDXWorks-actions/cache@main
182168
with:
@@ -193,16 +179,8 @@ jobs:
193179
with:
194180
# Shallow clones should be disabled for a better relevancy of analysis
195181
fetch-depth: 0
196-
- uses: RDXWorks-actions/rust-toolchain@master
197-
with:
198-
toolchain: stable
199-
- name: Set up JDK 17
200-
uses: RDXWorks-actions/setup-java@main
201-
with:
202-
distribution: 'zulu'
203-
java-version: '17'
204-
- name: Install libclang-dev
205-
run: sudo apt-get update -y && sudo apt-get install -y libclang-dev
182+
- name: Setup environment
183+
uses: ./.github/actions/setup-env
206184
- name: Cache Gradle packages
207185
uses: RDXWorks-actions/cache@main
208186
with:
@@ -221,16 +199,8 @@ jobs:
221199
with:
222200
# Shallow clones should be disabled for a better relevancy of analysis
223201
fetch-depth: 0
224-
- uses: RDXWorks-actions/rust-toolchain@master
225-
with:
226-
toolchain: stable
227-
- name: Set up JDK 17
228-
uses: RDXWorks-actions/setup-java@main
229-
with:
230-
distribution: 'zulu'
231-
java-version: '17'
232-
- name: Install libclang-dev
233-
run: sudo apt-get update -y && sudo apt-get install -y libclang-dev
202+
- name: Setup environment
203+
uses: ./.github/actions/setup-env
234204
- name: Cache Gradle packages
235205
uses: RDXWorks-actions/cache@main
236206
with:
@@ -248,14 +218,10 @@ jobs:
248218
- uses: RDXWorks-actions/checkout@main
249219
with:
250220
fetch-depth: 1
251-
- uses: RDXWorks-actions/rust-toolchain@master
221+
- name: Setup environment
222+
uses: ./.github/actions/setup-env
252223
with:
253-
toolchain: stable
254-
targets: x86_64-pc-windows-msvc
255-
- name: Update clang version to 16
256-
run: sudo apt remove clang-14 && sudo apt autoclean && sudo apt autoremove && wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16 && sudo ls /usr/bin/ | grep clang && sudo ln -sf /usr/bin/clang-16 /usr/bin/clang && sudo ln -sf /usr/bin/clang++-16 /usr/bin/clang++ && sudo apt-get install -y libclang-dev llvm llvm-dev
257-
- name: Install cargo-xwin
258-
run: cargo install cargo-xwin --version 0.17.1 --locked
224+
cross-compile-to-windows: "true"
259225
- name: cross compile to windows
260226
run: pushd core-rust; cargo xwin build --release --target x86_64-pc-windows-msvc
261227
- name: Publish corerust.dll

0 commit comments

Comments
 (0)