-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (98 loc) · 4.76 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: build nightly
# Controls when the workflow will run
on:
# Triggers the workflow on push
push:
# Triggers the workflow nightly (SGT)
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '32 13 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-xous-libstd:
runs-on: ubuntu-latest
steps:
- name: Determine Rust version
shell: bash
run: echo "version=nightly" >> $GITHUB_OUTPUT
id: extract_rust_version
- name: Setup riscv gnu/gcc toolchain
uses: gregdavill/setup-riscv-gnu-toolchain@v2.0
- name: Checkout repo
uses: actions/checkout@v2
with:
path: build
- name: Install Rust nightly toolchain ${{ steps.extract_rust_version.outputs.version }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.extract_rust_version.outputs.version }}
- name: Determine nightly hash
shell: bash
id: determine_nightly_hash
run: |
export rustrevshort="$(rustc --version | awk -F '[( ]+' '{print $3}')"
echo "rustrevshort=$rustrevshort" >> $GITHUB_OUTPUT
export rustrev="$(curl --silent \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/rust-lang/rust/commits/$rustrevshort" \
| grep "\"sha\":" \
| head -1 \
| cut -d'"' -f4)"
echo "rustrev=$rustrev" >> $GITHUB_OUTPUT
- name: Create riscv32imac-unknown-xous-elf sysroot
run: |
rm -rf $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf \
&& mkdir -p $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/lib \
&& rustc --version | awk '{print $2}' > $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/RUST_VERSION
- name: Configure fake git credentials
run: |
git config --global user.email "user@example.com" \
&& git config --global user.name "CI Runner"
- name: Check out rust version ${{ steps.determine_nightly_hash.outputs.rustrevshort }}
working-directory: build
run: |
echo "rustrev: ${{ steps.determine_nightly_hash.outputs.rustrev }}" \
&& git init rust \
&& cd rust \
&& git remote add origin https://github.com/rust-lang/rust \
&& git config --local gc.auto 0 \
&& git -c protocol.version=2 fetch --no-tags --prune --progress --recurse-submodules --depth=1 origin ${{ steps.determine_nightly_hash.outputs.rustrev }} \
&& git checkout -B master ${{ steps.determine_nightly_hash.outputs.rustrev }} \
&& git submodule sync --recursive \
&& git -c protocol.version=2 submodule update --init --force --depth=1 --recursive
- name: Apply patches to ${{ steps.determine_nightly_hash.outputs.rustrevshort }}
working-directory: build/rust
run: git am ../*.patch
- name: Build Rust libstd for xous
working-directory: build/rust
run: |
export RUST_COMPILER_RT_ROOT=$(pwd)/src/llvm-project/compiler-rt \
&& rm -rf target \
&& cargo build \
--target riscv32imac-unknown-xous-elf \
-Zbinary-dep-depinfo \
--release \
--features "panic-unwind compiler-builtins-c compiler-builtins-mem" \
--manifest-path "library/sysroot/Cargo.toml" \
&& cp library/target/riscv32imac-unknown-xous-elf/release/deps/*.rlib $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/lib \
&& (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/)
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
CARGO_PROFILE_RELEASE_OPT_LEVEL: 3
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: false
RUSTC_BOOTSTRAP: 1
RUSTFLAGS: -Cforce-unwind-tables=yes -Cembed-bitcode=yes
__CARGO_DEFAULT_LIB_METADATA: stablestd
CC: riscv-none-elf-gcc
AR: riscv-none-elf-ar