Skip to content

Commit e669944

Browse files
authored
Unified action for installing Linux deps (RustPython#7381)
1 parent f680f8a commit e669944

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This action installs a few dependencies necessary to build RustPython on Linux.
2+
# It can be configured depending on which libraries are needed:
3+
#
4+
# ```
5+
# - uses: ./.github/actions/install-linux-deps
6+
# with:
7+
# gcc-multilib: true
8+
# musl-tools: false
9+
# ```
10+
#
11+
# See the `inputs` section for all options and their defaults. Note that you must checkout the
12+
# repository before you can use this action.
13+
#
14+
# This action will only install dependencies when the current operating system is Linux. It will do
15+
# nothing on any other OS (macOS, Windows).
16+
17+
name: Install Linux dependencies
18+
description: Installs the dependencies necessary to build RustPython on Linux.
19+
inputs:
20+
gcc-multilib:
21+
description: Install gcc-multilib (gcc-multilib)
22+
required: false
23+
default: "false"
24+
musl-tools:
25+
description: Install musl-tools (musl-tools)
26+
required: false
27+
default: "false"
28+
gcc-aarch64-linux-gnu:
29+
description: Install gcc-aarch64-linux-gnu (gcc-aarch64-linux-gnu)
30+
required: false
31+
default: "false"
32+
clang:
33+
description: Install clang (clang)
34+
required: false
35+
default: "false"
36+
runs:
37+
using: composite
38+
steps:
39+
- name: Install Linux dependencies
40+
shell: bash
41+
if: ${{ runner.os == 'Linux' }}
42+
run: >
43+
sudo apt-get update
44+
45+
sudo apt-get install
46+
${{ fromJSON(inputs.gcc-multilib) && 'gcc-multilib' || '' }}
47+
${{ fromJSON(inputs.musl-tools) && 'musl-tools' || '' }}
48+
${{ fromJSON(inputs.clang) && 'clang' || '' }}
49+
${{ fromJSON(inputs.gcc-aarch64-linux-gnu) && 'gcc-aarch64-linux-gnu' || '' }}

.github/workflows/ci.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ jobs:
217217
target: i686-unknown-linux-gnu
218218

219219
- name: Install gcc-multilib and musl-tools
220-
run: sudo apt-get update && sudo apt-get install gcc-multilib musl-tools
220+
uses: ./.github/actions/install-linux-deps
221+
with:
222+
gcc-multilib: true
223+
musl-tools: true
224+
221225
- name: Check compilation for x86 32bit
222226
run: cargo check --target i686-unknown-linux-gnu ${{ env.CARGO_ARGS_NO_SSL }}
223227

@@ -244,7 +248,10 @@ jobs:
244248
target: aarch64-unknown-linux-gnu
245249

246250
- name: Install gcc-aarch64-linux-gnu
247-
run: sudo apt install gcc-aarch64-linux-gnu
251+
uses: ./.github/actions/install-linux-deps
252+
with:
253+
gcc-aarch64-linux-gnu: true
254+
248255
- name: Check compilation for aarch64 linux gnu
249256
run: cargo check --target aarch64-unknown-linux-gnu ${{ env.CARGO_ARGS_NO_SSL }}
250257

@@ -597,8 +604,12 @@ jobs:
597604
- uses: Swatinem/rust-cache@v2
598605
- name: Setup Wasmer
599606
uses: wasmerio/setup-wasmer@v3
607+
600608
- name: Install clang
601-
run: sudo apt-get update && sudo apt-get install clang -y
609+
uses: ./.github/actions/install-linux-deps
610+
with:
611+
clang: true
612+
602613
- name: build rustpython
603614
run: cargo build --release --target wasm32-wasip1 --features freeze-stdlib,stdlib --verbose
604615
- name: run snippets

0 commit comments

Comments
 (0)