Simplify some code in examples #2465
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- auto | |
- try | |
pull_request: | |
branches: | |
- master | |
jobs: | |
style: | |
name: Check Style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update nightly --no-self-update && rustup default nightly | |
- run: ci/style.sh | |
docs: | |
name: Build Documentation | |
needs: [style] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update nightly --no-self-update && rustup default nightly | |
- run: ci/dox.sh | |
env: | |
CI: 1 | |
- name: Publish documentation | |
run: | | |
cd target/doc | |
git init | |
git add . | |
git -c user.name='ci' -c user.email='ci' commit -m init | |
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages | |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' | |
verify: | |
name: Automatic intrinsic verification | |
needs: [style] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update nightly --no-self-update && rustup default nightly | |
- run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml | |
env_override: | |
name: Env Override | |
needs: [style] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update nightly --no-self-update && rustup default nightly | |
- run: RUST_STD_DETECT_UNSTABLE=avx cargo test --features=std_detect_env_override --manifest-path crates/std_detect/Cargo.toml env_override_no_avx | |
shell: bash | |
test: | |
needs: [style] | |
name: Test | |
runs-on: ${{ matrix.target.os }} | |
strategy: | |
matrix: | |
profile: | |
- dev | |
- release | |
target: | |
# Dockers that are run through docker on linux | |
- tuple: i686-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: x86_64-unknown-linux-gnu-emulated | |
os: ubuntu-latest | |
- tuple: arm-unknown-linux-gnueabihf | |
os: ubuntu-latest | |
- tuple: armv7-unknown-linux-gnueabihf | |
os: ubuntu-latest | |
- tuple: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: riscv64gc-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: powerpc64le-unknown-linux-gnu | |
os: ubuntu-latest | |
# MIPS targets disabled since they are dropped to tier 3. | |
# See https://github.com/rust-lang/compiler-team/issues/648 | |
#- tuple: mips-unknown-linux-gnu | |
# os: ubuntu-latest | |
#- tuple: mips64-unknown-linux-gnuabi64 | |
# os: ubuntu-latest | |
#- tuple: mips64el-unknown-linux-gnuabi64 | |
# os: ubuntu-latest | |
#- tuple: mipsel-unknown-linux-musl | |
# os: ubuntu-latest | |
- tuple: s390x-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: i586-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: nvptx64-nvidia-cuda | |
os: ubuntu-latest | |
- tuple: thumbv6m-none-eabi | |
os: ubuntu-latest | |
- tuple: thumbv7m-none-eabi | |
os: ubuntu-latest | |
- tuple: thumbv7em-none-eabi | |
os: ubuntu-latest | |
- tuple: thumbv7em-none-eabihf | |
os: ubuntu-latest | |
- tuple: loongarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
- tuple: wasm32-wasip1 | |
os: ubuntu-latest | |
# macOS targets | |
- tuple: x86_64-apple-darwin | |
os: macos-13 | |
- tuple: x86_64-apple-ios-macabi | |
os: macos-13 | |
- tuple: aarch64-apple-darwin | |
os: macos-latest | |
- tuple: aarch64-apple-ios-macabi | |
os: macos-latest | |
# FIXME: gh-actions build environment doesn't have linker support | |
# - tuple: i686-apple-darwin | |
# os: macos-13 | |
# Windows targets | |
- tuple: x86_64-pc-windows-msvc | |
os: windows-latest | |
- tuple: i686-pc-windows-msvc | |
os: windows-latest | |
- tuple: aarch64-pc-windows-msvc | |
os: windows-latest | |
- tuple: x86_64-pc-windows-gnu | |
os: windows-latest | |
# - tuple: i686-pc-windows-gnu | |
# os: windows-latest | |
# Add additional variables to the matrix variations generated above using `include`: | |
include: | |
- target: | |
tuple: x86_64-unknown-linux-gnu-emulated | |
os: ubuntu-latest | |
test_everything: true | |
rustflags: --cfg stdarch_intel_sde | |
# MIPS targets disabled since they are dropped to tier 3. | |
# See https://github.com/rust-lang/compiler-team/issues/648 | |
#- target: | |
# tuple: mips-unknown-linux-gnu | |
# os: ubuntu-latest | |
# norun: true | |
#- target: | |
# tuple: mips64-unknown-linux-gnuabi64 | |
# os: ubuntu-latest | |
# norun: true | |
#- target: | |
# tuple: mips64el-unknown-linux-gnuabi64 | |
# os: ubuntu-latest | |
# norun: true | |
#- target: | |
# tuple: mipsel-unknown-linux-musl | |
# os: ubuntu-latest | |
# norun: true | |
- target: | |
tuple: powerpc64le-unknown-linux-gnu | |
os: ubuntu-latest | |
disable_assert_instr: true | |
- target: | |
tuple: aarch64-apple-darwin | |
os: macos-latest | |
norun: true # https://github.com/rust-lang/stdarch/issues/1206 | |
- target: | |
tuple: aarch64-apple-ios-macabi | |
os: macos-latest | |
norun: true # https://github.com/rust-lang/stdarch/issues/1206 | |
- target: | |
tuple: aarch64-pc-windows-msvc | |
os: windows-latest | |
norun: true | |
- target: | |
tuple: x86_64-pc-windows-msvc | |
os: windows-latest | |
profile: dev | |
norun: true # FIXME: why doesn't this work in debug mode? | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
run: | | |
rustup update nightly --no-self-update | |
rustup default nightly | |
- run: rustup target add ${{ matrix.target.tuple }} | |
if: "!endsWith(matrix.target.tuple, 'emulated')" | |
- run: cargo generate-lockfile | |
# Configure some env vars based on matrix configuration | |
- run: echo "PROFILE=--profile=${{matrix.profile}}" >> $GITHUB_ENV | |
shell: bash | |
- run: echo "NORUN=1" >> $GITHUB_ENV | |
shell: bash | |
if: matrix.norun != '' || startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda' | |
- run: echo "STDARCH_TEST_EVERYTHING=1" >> $GITHUB_ENV | |
shell: bash | |
if: matrix.test_everything != '' | |
- run: echo "RUSTFLAGS=${{ matrix.rustflags }}" >> $GITHUB_ENV | |
shell: bash | |
if: matrix.rustflags != '' | |
- run: echo "STDARCH_DISABLE_ASSERT_INSTR=1" >> $GITHUB_ENV | |
shell: bash | |
if: matrix.disable_assert_instr != '' | |
- run: echo "NOSTD=1" >> $GITHUB_ENV | |
shell: bash | |
if: startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda' | |
# Windows & OSX go straight to `run.sh` ... | |
- run: ./ci/run.sh | |
shell: bash | |
if: matrix.target.os != 'ubuntu-latest' || startsWith(matrix.target.tuple, 'thumb') | |
env: | |
TARGET: ${{ matrix.target.tuple }} | |
# ... while Linux goes to `run-docker.sh` | |
- run: ./ci/run-docker.sh ${{ matrix.target.tuple }} | |
shell: bash | |
if: "matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')" | |
env: | |
TARGET: ${{ matrix.target.tuple }} | |
build-std-detect: | |
needs: [style] | |
name: Build std_detect | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update nightly && rustup default nightly | |
- run: ./ci/build-std-detect.sh | |
success: | |
needs: | |
- docs | |
- verify | |
- env_override | |
- test | |
- build-std-detect | |
runs-on: ubuntu-latest | |
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency | |
# failed" as success. So we have to do some contortions to ensure the job fails if any of its | |
# dependencies fails. | |
if: always() # make sure this is never "skipped" | |
steps: | |
# Manually check the status of all dependencies. `if: failure()` does not work. | |
- name: check if any dependency failed | |
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |