Skip to content

Commit c5c806c

Browse files
eupnbadicsalex
authored andcommitted
ci: update
1 parent f7b5ed6 commit c5c806c

File tree

1 file changed

+61
-21
lines changed

1 file changed

+61
-21
lines changed

.github/workflows/rust-xous-release.yml

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,101 @@ jobs:
66
build-libstd:
77
runs-on: ubuntu-latest
88

9-
steps:
10-
- name: Setup riscv gnu/gcc toolchain
11-
uses: gregdavill/[email protected]
9+
strategy:
10+
matrix:
11+
target: [armv7a-unknown-xous-elf]
1212

13+
steps:
1314
- name: Checkout
1415
uses: actions/checkout@v2
1516
with:
1617
submodules: 'recursive'
1718

18-
- name: Determine Rust version
19+
- name: Setup ARM Profile-A GCC toolchain
20+
run: sudo apt install gcc-arm-none-eabi
21+
if: matrix.target == 'armv7a-unknown-xous-elf'
22+
23+
- name: Extract Rust information.
1924
shell: bash
20-
run: echo "version=$(echo ${GITHUB_REF} | cut -d/ -f3 | cut -d- -f1 | cut -d. -f1,2,3)" >> $GITHUB_OUTPUT
21-
id: extract_rust_version
25+
id: extract_rust_info
26+
run: |
27+
case "${{ matrix.target }}" in
28+
riscv32imac-unknown-xous-elf)
29+
target=riscv32imac-unknown-none-elf
30+
target_cross_compile=riscv-none-embed
31+
;;
32+
33+
armv7a-unknown-xous-elf)
34+
target=armv7a-none-eabi
35+
target_cross_compile=arm-none-eabi
36+
;;
37+
esac
38+
39+
if [[ ${GITHUB_REF} == *"nightly"* ]]; then
40+
# Extract the nightly toolchain version in the format <version>-<nightly-yyyy-mm-dd>
41+
echo "##[set-output name=version;]$(echo ${GITHUB_REF} | cut -d- -f2,3,4,5)"
42+
else
43+
echo "##[set-output name=version;]$(echo ${GITHUB_REF} | cut -d- -f1 | cut -d. -f1,2,3)"
44+
fi
45+
46+
echo "##[set-output name=target;]$target"
47+
echo "##[set-output name=cc;]$target_cross_compile-gcc"
48+
echo "##[set-output name=ar;]$target_cross_compile-ar"
2249
23-
- name: Install Rust toolchain v${{ steps.extract_rust_version.outputs.version }}
50+
51+
- name: Install Rust toolchain v${{ steps.extract_rust_info.outputs.version }}
2452
uses: actions-rs/toolchain@v1
2553
with:
26-
toolchain: ${{ steps.extract_rust_version.outputs.version }}
54+
toolchain: ${{ steps.extract_rust_info.outputs.version }}
2755
default: true
2856
override: true
29-
target: riscv32imac-unknown-none-elf
57+
target: ${{ steps.extract_rust_info.outputs.target }}
3058

31-
- name: Install riscv32imac-unknown-xous-elf toolchain file
59+
- name: Install toolchain file
3260
run: |
33-
rm -rf $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf \
34-
&& mkdir -p $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/lib \
35-
&& rustc --version | awk '{print $2}' > $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/RUST_VERSION
61+
rm -rf $(rustc --print sysroot)/lib/rustlib/${{ matrix.target }} \
62+
&& mkdir -p $(rustc --print sysroot)/lib/rustlib/${{ matrix.target }}/lib \
63+
&& cp ${{ matrix.target }}.json $(rustc --print sysroot)/lib/rustlib/${{ matrix.target }}/target.json \
64+
&& rustc --version | awk '{print $2}' > $(rustc --print sysroot)/lib/rustlib/${{ matrix.target }}/RUST_VERSION
65+
66+
- name: Patch LLVM for 128-bit support
67+
run: sed -i '/^#define CRT_HAS_128BIT/d' src/llvm-project/compiler-rt/lib/builtins/int_types.h
68+
69+
- uses: webfactory/[email protected]
70+
with:
71+
ssh-private-key: |
72+
${{ secrets.SSH_KEY }}
73+
${{ secrets.SSH_KEY_AT91BOOTSTRAP }}
74+
${{ secrets.SSH_KEY_AT91BOOTSTRAP_FFI }}
3675
3776
- name: Build Rust libstd
3877
run: |
3978
export RUST_COMPILER_RT_ROOT=$(pwd)/src/llvm-project/compiler-rt \
4079
&& rm -rf target \
4180
&& cargo build \
42-
--target riscv32imac-unknown-xous-elf \
81+
--target ${{ matrix.target }} \
4382
-Zbinary-dep-depinfo \
4483
--release \
4584
--features "panic-unwind compiler-builtins-c compiler-builtins-mem" \
4685
--manifest-path "library/sysroot/Cargo.toml" \
47-
&& cp library/target/riscv32imac-unknown-xous-elf/release/deps/*.rlib $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/lib \
48-
&& (dest=$(pwd) && cd $(rustc --print sysroot) && zip -r ${dest}/riscv32imac-unknown-xous_${{ steps.extract_rust_version.outputs.version }}.zip lib/rustlib/riscv32imac-unknown-xous-elf/)
86+
&& cp library/target/${{ matrix.target }}/release/deps/*.rlib $(rustc --print sysroot)/lib/rustlib/${{ matrix.target }}/lib \
87+
&& (dest=$(pwd) && cd $(rustc --print sysroot) && zip -r ${dest}/${{ matrix.target }}_${{ steps.extract_rust_info.outputs.version }}.zip lib/rustlib/${{ matrix.target }}/)
4988
env:
89+
CARGO_NET_GIT_FETCH_WITH_CLI: true
5090
CARGO_PROFILE_RELEASE_DEBUG: 0
51-
CARGO_PROFILE_RELEASE_OPT_LEVEL: 3
5291
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: false
92+
CARGO_PROFILE_RELEASE_OPT_LEVEL: 3
5393
RUSTC_BOOTSTRAP: 1
54-
RUSTFLAGS: -Cforce-unwind-tables=yes -Cembed-bitcode=yes -Zforce-unstable-if-unmarked
94+
RUSTFLAGS: --cfg keyos --check-cfg=cfg(keyos) -Cforce-unwind-tables=yes -Cembed-bitcode=yes -Zforce-unstable-if-unmarked
5595
__CARGO_DEFAULT_LIB_METADATA: stablestd
56-
CC: riscv-none-embed-gcc
57-
AR: riscv-none-embed-ar
96+
CC: ${{ steps.extract_rust_info.outputs.cc }}
97+
AR: ${{ steps.extract_rust_info.outputs.ar }}
5898

5999
- name: Release
60100
uses: softprops/action-gh-release@v1
61101
if: startsWith(github.ref, 'refs/tags/')
62102
with:
63103
files: |
64-
riscv32imac-unknown-xous_${{ steps.extract_rust_version.outputs.version }}.zip
104+
${{ matrix.target }}_${{ steps.extract_rust_info.outputs.version }}.zip
65105
env:
66106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)