Skip to content

Commit 3a5dbb4

Browse files
committed
submodules
1 parent 454bfa7 commit 3a5dbb4

File tree

264 files changed

+30255
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+30255
-10
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "libm"]
2-
path = libm
2+
path = compiler-builtins/libm
33
url = https://github.com/rust-lang/libm.git
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.md]
16+
# double whitespace at end of line
17+
# denotes a line break in Markdown
18+
trim_trailing_whitespace = false
19+
20+
[*.yml]
21+
indent_size = 2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Use `git config blame.ignorerevsfile .git-blame-ignore-revs` to make
2+
# `git blame` ignore the following commits.
3+
4+
# Reformat with a new `.rustfmt.toml`
5+
5882cabb83c30bf7c36023f9a55a80583636b0e8
Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUSTDOCFLAGS: -Dwarnings
11+
RUSTFLAGS: -Dwarnings
12+
RUST_BACKTRACE: full
13+
BENCHMARK_RUSTC: nightly-2025-01-16 # Pin the toolchain for reproducable results
14+
15+
jobs:
16+
test:
17+
name: Build and test
18+
timeout-minutes: 60
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- target: aarch64-apple-darwin
24+
os: macos-15
25+
# FIXME: pinned due to https://github.com/llvm/llvm-project/issues/127804
26+
channel: nightly-2025-02-07
27+
- target: aarch64-unknown-linux-gnu
28+
os: ubuntu-24.04-arm
29+
# FIXME: pinned due to https://github.com/llvm/llvm-project/issues/127804
30+
channel: nightly-2025-02-07
31+
- target: aarch64-pc-windows-msvc
32+
os: windows-2025
33+
build_only: 1 # Can't run on x86 hosts
34+
- target: arm-unknown-linux-gnueabi
35+
os: ubuntu-24.04
36+
- target: arm-unknown-linux-gnueabihf
37+
os: ubuntu-24.04
38+
- target: armv7-unknown-linux-gnueabihf
39+
os: ubuntu-24.04
40+
- target: i586-unknown-linux-gnu
41+
os: ubuntu-24.04
42+
- target: i686-unknown-linux-gnu
43+
os: ubuntu-24.04
44+
- target: loongarch64-unknown-linux-gnu
45+
os: ubuntu-24.04
46+
- target: powerpc-unknown-linux-gnu
47+
os: ubuntu-24.04
48+
- target: powerpc64-unknown-linux-gnu
49+
os: ubuntu-24.04
50+
- target: powerpc64le-unknown-linux-gnu
51+
os: ubuntu-24.04
52+
- target: riscv64gc-unknown-linux-gnu
53+
os: ubuntu-24.04
54+
- target: thumbv6m-none-eabi
55+
os: ubuntu-24.04
56+
- target: thumbv7em-none-eabi
57+
os: ubuntu-24.04
58+
- target: thumbv7em-none-eabihf
59+
os: ubuntu-24.04
60+
- target: thumbv7m-none-eabi
61+
os: ubuntu-24.04
62+
- target: x86_64-unknown-linux-gnu
63+
os: ubuntu-24.04
64+
- target: x86_64-apple-darwin
65+
os: macos-13
66+
- target: wasm32-unknown-unknown
67+
os: ubuntu-24.04
68+
build_only: 1
69+
- target: i686-pc-windows-msvc
70+
os: windows-2025
71+
- target: x86_64-pc-windows-msvc
72+
os: windows-2025
73+
- target: i686-pc-windows-gnu
74+
os: windows-2025
75+
# FIXME: pinned due to https://github.com/rust-lang/rust/issues/136795
76+
channel: nightly-2025-02-07-i686-gnu
77+
- target: x86_64-pc-windows-gnu
78+
os: windows-2025
79+
channel: nightly-x86_64-gnu
80+
runs-on: ${{ matrix.os }}
81+
env:
82+
BUILD_ONLY: ${{ matrix.build_only }}
83+
steps:
84+
- name: Print runner information
85+
run: uname -a
86+
- uses: actions/checkout@v4
87+
with:
88+
submodules: true
89+
- name: Install Rust (rustup)
90+
shell: bash
91+
run: |
92+
channel="nightly"
93+
# Account for channels that have required components (MinGW)
94+
[ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}"
95+
rustup update "$channel" --no-self-update
96+
rustup default "$channel"
97+
rustup target add "${{ matrix.target }}"
98+
rustup component add clippy llvm-tools-preview
99+
- uses: taiki-e/install-action@nextest
100+
- uses: Swatinem/rust-cache@v2
101+
with:
102+
key: ${{ matrix.target }}
103+
104+
- name: Verify API list
105+
if: matrix.os == 'ubuntu-24.04'
106+
run: python3 etc/update-api-list.py --check
107+
108+
# Non-linux tests just use our raw script
109+
- name: Run locally
110+
if: matrix.os != 'ubuntu-24.04' || contains(matrix.target, 'wasm')
111+
shell: bash
112+
run: ./ci/run.sh ${{ matrix.target }}
113+
114+
# Otherwise we use our docker containers to run builds
115+
- name: Run in Docker
116+
if: matrix.os == 'ubuntu-24.04' && !contains(matrix.target, 'wasm')
117+
run: |
118+
rustup target add x86_64-unknown-linux-musl
119+
cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
120+
121+
- name: Print test logs if available
122+
if: always()
123+
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
124+
shell: bash
125+
126+
clippy:
127+
name: Clippy
128+
runs-on: ubuntu-24.04
129+
timeout-minutes: 10
130+
steps:
131+
- uses: actions/checkout@master
132+
with:
133+
submodules: true
134+
- name: Install Rust
135+
run: |
136+
rustup update nightly --no-self-update
137+
rustup default nightly
138+
rustup component add clippy
139+
- uses: Swatinem/rust-cache@v2
140+
- run: cargo clippy --all --all-features --all-targets
141+
142+
builtins:
143+
name: Check use with compiler-builtins
144+
runs-on: ubuntu-24.04
145+
timeout-minutes: 10
146+
steps:
147+
- uses: actions/checkout@master
148+
- name: Install Rust
149+
run: rustup update nightly --no-self-update && rustup default nightly
150+
- uses: Swatinem/rust-cache@v2
151+
- run: cargo check --manifest-path crates/compiler-builtins-smoke-test/Cargo.toml
152+
- run: cargo test --manifest-path crates/compiler-builtins-smoke-test/Cargo.toml
153+
154+
benchmarks:
155+
name: Benchmarks
156+
runs-on: ubuntu-24.04
157+
timeout-minutes: 20
158+
steps:
159+
- uses: actions/checkout@master
160+
with:
161+
submodules: true
162+
- uses: taiki-e/install-action@cargo-binstall
163+
164+
- name: Set up dependencies
165+
run: |
166+
sudo apt update
167+
sudo apt install -y valgrind gdb libc6-dbg # Needed for iai-callgrind
168+
rustup update "$BENCHMARK_RUSTC" --no-self-update
169+
rustup default "$BENCHMARK_RUSTC"
170+
# Install the version of iai-callgrind-runner that is specified in Cargo.toml
171+
iai_version="$(cargo metadata --format-version=1 --features icount |
172+
jq -r '.packages[] | select(.name == "iai-callgrind").version')"
173+
cargo binstall -y iai-callgrind-runner --version "$iai_version"
174+
sudo apt-get install valgrind
175+
176+
- uses: Swatinem/rust-cache@v2
177+
178+
- name: Run icount benchmarks
179+
env:
180+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181+
PR_NUMBER: ${{ github.event.pull_request.number }}
182+
run: ./ci/bench-icount.sh
183+
184+
- name: Upload the benchmark baseline
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: ${{ env.BASELINE_NAME }}
188+
path: ${{ env.BASELINE_NAME }}.tar.xz
189+
190+
- name: Run wall time benchmarks
191+
run: |
192+
# Always use the same seed for benchmarks. Ideally we should switch to a
193+
# non-random generator.
194+
export LIBM_SEED=benchesbenchesbenchesbencheswoo!
195+
cargo bench --all --features short-benchmarks,build-musl,force-soft-floats
196+
197+
- name: Print test logs if available
198+
if: always()
199+
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
200+
shell: bash
201+
202+
msrv:
203+
name: Check MSRV
204+
runs-on: ubuntu-24.04
205+
timeout-minutes: 10
206+
env:
207+
RUSTFLAGS: # No need to check warnings on old MSRV, unset `-Dwarnings`
208+
steps:
209+
- uses: actions/checkout@master
210+
- run: |
211+
msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' Cargo.toml)"
212+
echo "MSRV: $msrv"
213+
echo "MSRV=$msrv" >> "$GITHUB_ENV"
214+
- name: Install Rust
215+
run: rustup update "$MSRV" --no-self-update && rustup default "$MSRV"
216+
- uses: Swatinem/rust-cache@v2
217+
- run: cargo build -p libm
218+
219+
rustfmt:
220+
name: Rustfmt
221+
runs-on: ubuntu-24.04
222+
timeout-minutes: 10
223+
steps:
224+
- uses: actions/checkout@master
225+
- name: Install Rust
226+
run: |
227+
rustup update nightly --no-self-update
228+
rustup default nightly
229+
rustup component add rustfmt
230+
- run: cargo fmt -- --check
231+
232+
# Determine which extensive tests should be run based on changed files.
233+
calculate_extensive_matrix:
234+
name: Calculate job matrix
235+
runs-on: ubuntu-24.04
236+
timeout-minutes: 10
237+
outputs:
238+
matrix: ${{ steps.script.outputs.matrix }}
239+
steps:
240+
- uses: actions/checkout@v4
241+
with:
242+
fetch-depth: 100
243+
- name: Fetch pull request ref
244+
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
245+
if: github.event_name == 'pull_request'
246+
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
247+
id: script
248+
249+
extensive:
250+
name: Extensive tests for ${{ matrix.ty }}
251+
needs:
252+
# Wait on `clippy` so we have some confidence that the crate will build
253+
- clippy
254+
- calculate_extensive_matrix
255+
runs-on: ubuntu-24.04
256+
timeout-minutes: 180
257+
strategy:
258+
matrix:
259+
# Use the output from `calculate_extensive_matrix` to calculate the matrix
260+
# FIXME: it would be better to run all jobs (i.e. all types) but mark those that
261+
# didn't change as skipped, rather than completely excluding the job. However,
262+
# this is not currently possible https://github.com/actions/runner/issues/1985.
263+
include: ${{ fromJSON(needs.calculate_extensive_matrix.outputs.matrix).matrix }}
264+
env:
265+
CHANGED: ${{ matrix.changed }}
266+
steps:
267+
- uses: actions/checkout@v4
268+
with:
269+
submodules: true
270+
- name: Install Rust
271+
run: |
272+
rustup update nightly --no-self-update
273+
rustup default nightly
274+
- uses: Swatinem/rust-cache@v2
275+
- name: Run extensive tests
276+
run: |
277+
echo "Changed: '$CHANGED'"
278+
if [ -z "$CHANGED" ]; then
279+
echo "No tests to run, exiting."
280+
exit
281+
fi
282+
283+
# Run the non-extensive tests first to catch any easy failures
284+
cargo t --profile release-checked -- "$CHANGED"
285+
286+
LIBM_EXTENSIVE_TESTS="$CHANGED" cargo t \
287+
--features build-mpfr,unstable,force-soft-floats \
288+
--profile release-checked \
289+
-- extensive
290+
- name: Print test logs if available
291+
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
292+
shell: bash
293+
294+
success:
295+
needs:
296+
- test
297+
- builtins
298+
- benchmarks
299+
- msrv
300+
- rustfmt
301+
- extensive
302+
runs-on: ubuntu-24.04
303+
timeout-minutes: 10
304+
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
305+
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
306+
# dependencies fails.
307+
if: always() # make sure this is never "skipped"
308+
steps:
309+
# Manually check the status of all dependencies. `if: failure()` does not work.
310+
- name: check if any dependency failed
311+
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release-plz
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
release-plz:
14+
name: Release-plz
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Install Rust (rustup)
22+
run: rustup update nightly --no-self-update && rustup default nightly
23+
- name: Run release-plz
24+
uses: MarcoIeni/[email protected]
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

compiler-builtins/libm/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**.bk
2+
.#*
3+
/bin
4+
/math/src
5+
target
6+
Cargo.lock
7+
**.tar.gz
8+
9+
# Benchmark cache
10+
iai-home
11+
baseline-*

compiler-builtins/libm/.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "musl"]
2+
path = crates/musl-math-sys/musl
3+
url = https://git.musl-libc.org/git/musl
4+
shallow = true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This matches rustc
2+
style_edition = "2024"
3+
use_small_heuristics = "Max"
4+
group_imports = "StdExternalCrate"
5+
imports_granularity = "Module"

0 commit comments

Comments
 (0)