Migrate CI to GitHub Actions (#813)

* Migrate CI to GitHub Actions

This involves less secret and user management than azure pipelines, has
more concurrency by default for repos, and in general has a bit more
modern syntax!

* Disable clippy on CI for now

Looks like it's got quite a few errors
This commit is contained in:
Alex Crichton 2019-09-24 09:03:56 -05:00 committed by GitHub
parent 59fee20836
commit d7f3c0bbb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 207 additions and 310 deletions

View file

@ -0,0 +1,203 @@
name: CI
on:
push:
branches:
- auto
- try
pull_request:
branches:
- master
jobs:
style:
name: Check Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: ci/style.sh
docs:
name: Build Documentation
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && 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@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml
env_override:
name: Env Override
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && 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
test:
needs: [style]
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
# Dockers that are run through docker on linux
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-gnu-emulated
- arm-unknown-linux-gnueabihf
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- s390x-unknown-linux-gnu
- wasm32-unknown-unknown
- i586-unknown-linux-gnu
- x86_64-linux-android
- arm-linux-androideabi
- mipsel-unknown-linux-musl
- aarch64-linux-android
- nvptx64-nvidia-cuda
- thumbv6m-none-eabi
- thumbv7m-none-eabi
- thumbv7em-none-eabi
- thumbv7em-none-eabihf
# macOS targets
- x86_64-apple-darwin
# FIXME: gh-actions build environment doesn't have linker support
# - i686-apple-darwin
# Windows targets
- x86_64-pc-windows-msvc
# FIXME: Disassembly not implemented for the # following targets:
# - x86_64-pc-windows-gnu:
# - i686-pc-windows-gnu:
# - i686-pc-windows-msvc:
include:
- target: i686-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu-emulated
os: ubuntu-latest
test_everything: true
rustflags: --cfg stdarch_intel_sde
- target: arm-unknown-linux-gnueabihf
os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
rustflags: -C target-feature=+neon
- target: mips-unknown-linux-gnu
os: ubuntu-latest
norun: true
- target: mips64-unknown-linux-gnuabi64
os: ubuntu-latest
norun: true
- target: mips64el-unknown-linux-gnuabi64
os: ubuntu-latest
norun: true
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-latest
disable_assert_instr: true
- target: s390x-unknown-linux-gnu
os: ubuntu-latest
- target: wasm32-unknown-unknown
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: i586-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-linux-android
os: ubuntu-latest
disable_assert_instr: 1
- target: arm-linux-androideabi
os: ubuntu-latest
disable_assert_instr: 1
- target: mipsel-unknown-linux-musl
os: ubuntu-latest
norun: 1
- target: aarch64-linux-android
os: ubuntu-latest
disable_assert_instr: 1
- target: nvptx64-nvidia-cuda
os: ubuntu-latest
- target: thumbv6m-none-eabi
os: ubuntu-latest
- target: thumbv7m-none-eabi
os: ubuntu-latest
- target: thumbv7em-none-eabi
os: ubuntu-latest
- target: thumbv7em-none-eabihf
os: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust (rustup)
run: rustup update nightly --no-self-update && rustup default nightly
if: matrix.os != 'macos-latest'
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
echo "##[add-path]$HOME/.cargo/bin"
if: matrix.os == 'macos-latest'
- run: rustup target add ${{ matrix.target }}
if: "!endsWith(matrix.target, 'emulated')"
- run: cargo generate-lockfile
# Configure some env vars based on matrix configuration
- run: echo "##[set-env name=NORUN]1"
if: matrix.norun != '' || startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'
- run: echo "##[set-env name=STDARCH_TEST_EVERYTHING]1"
if: matrix.test_everything != ''
- run: echo "##[set-env name=RUSTFLAGS]${{ matrix.rustflags }}"
if: matrix.rustflags != ''
- run: echo "##[set-env name=STDARCH_DISABLE_ASSERT_INSTR]1"
if: matrix.disable_assert_instr != ''
- run: echo "##[set-env name=NOSTD]1"
if: startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'
# Windows & OSX go straight to `run.sh` ...
- run: ./ci/run.sh
shell: bash
if: matrix.os != 'ubuntu-latest' || startsWith(matrix.target, 'thumb')
env:
TARGET: ${{ matrix.target }}
# ... while Linux goes to `run-docker.sh`
- run: ./ci/run-docker.sh ${{ matrix.target }}
shell: bash
if: "matrix.os == 'ubuntu-latest' && !startsWith(matrix.target, 'thumb')"
env:
TARGET: ${{ matrix.target }}

View file

@ -1,76 +0,0 @@
steps:
- bash: |
set -ex
toolchain=$TOOLCHAIN
if [ "$toolchain" = "" ]; then
toolchain=nightly
fi
if command -v rustup; then
rustup update $toolchain
rustup default $toolchain
else
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain
echo "##vso[task.prependpath]$HOME/.cargo/bin"
fi
displayName: Install rust (unix)
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- script: |
@echo on
if not defined TOOLCHAIN set TOOLCHAIN=nightly
rustup update --no-self-update %TOOLCHAIN%-%TARGET%
rustup default %TOOLCHAIN%-%TARGET%
displayName: Install rust (windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
set -ex
if [ -n "${TARGET}" ] && [ "${TARGET}" != "x86_64-unknown-linux-gnu-emulated" ]; then
rustup target add $TARGET
fi
condition: ne( variables['Agent.OS'], 'Windows_NT' )
displayName: Install target (unix)
- script: |
@echo on
if defined TARGET rustup target add %TARGET%
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install target (windows)
- script: |
@echo on
if "%ARCH%" == "i686" choco install mingw --x86 --force
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install MinGW32 (windows)
- bash: |
set -ex
gcc -print-search-dirs
find "C:\ProgramData\Chocolatey" -name "crt2*"
find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Find GCC libraries (windows)
- bash: |
set -ex
if [[ -n ${ARCH_BITS} ]]; then
for i in crt2.o dllcrt2.o libmsvcrt.a ; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw${ARCH_BITS}/${ARCH}-w64-mingw32/lib/$i" "`rustc --print sysroot`/lib/rustlib/${TARGET}/lib"
done
fi
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Fix MinGW (windows)
- bash: |
set -ex
rustc -Vv
cargo -V
rustup -Vv
rustup show
which rustc
which cargo
which rustup
displayName: Query rust and cargo versions
- script: |
@echo on
where gcc
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Query gcc path
- bash: |
set -ex
cargo generate-lockfile
displayName: Generate lockfiles

View file

@ -1,230 +0,0 @@
variables:
- group: secrets
resources:
repositories:
- repository: rustinfra
type: github
name: rust-lang/simpleinfra
endpoint: gnzlbg
trigger: ["auto", "try"]
pr: ["master"]
jobs:
- job: DockerLinux0
dependsOn: StyleAndDocs
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
- bash: |
if [ "${NO_DOCKER}" = "1" ]; then
ci/run.sh $TARGET
else
ci/run-docker.sh $TARGET
fi
displayName: Execute run-docker.sh
strategy:
matrix:
i686-unknown-linux-gnu:
TARGET: i686-unknown-linux-gnu
x86_64-unknown-linux-gnu:
TARGET: x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnu-emulated:
TARGET: x86_64-unknown-linux-gnu-emulated
STDARCH_TEST_EVERYTHING: 1
RUSTFLAGS: --cfg stdarch_intel_sde
arm-unknown-linux-gnueabihf:
TARGET: arm-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabihf:
TARGET: armv7-unknown-linux-gnueabihf
RUSTFLAGS: -C target-feature=+neon
aarch64-unknown-linux-gnu:
TARGET: aarch64-unknown-linux-gnu
mips-unknown-linux-gnu:
TARGET: mips-unknown-linux-gnu
NORUN: 1
mips64-unknown-linux-gnuabi64:
TARGET: mips64-unknown-linux-gnuabi64
NORUN: 1
mips64el-unknown-linux-gnuabi64:
TARGET: mips64el-unknown-linux-gnuabi64
NORUN: 1
powerpc64le-unknown-linux-gnu:
TARGET: powerpc64le-unknown-linux-gnu
STDARCH_DISABLE_ASSERT_INSTR: 1
s390x-unknown-linux-gnu:
TARGET: s390x-unknown-linux-gnu
wasm32-unknown-unknown:
TARGET: wasm32-unknown-unknown
- job: DockerLinux1
dependsOn: DockerLinux0
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
- bash: |
if [ "${NO_DOCKER}" = "1" ]; then
ci/run.sh $TARGET
else
ci/run-docker.sh $TARGET
fi
displayName: Execute run-docker.sh
strategy:
matrix:
i586-unknown-linux-gnu:
TARGET: i586-unknown-linux-gnu
x86_64-linux-android:
TARGET: x86_64-linux-android
STDARCH_DISABLE_ASSERT_INSTR: 1
arm-linux-androideabi:
TARGET: arm-linux-androideabi
STDARCH_DISABLE_ASSERT_INSTR: 1
mipsel-unknown-linux-musl:
TARGET: mipsel-unknown-linux-musl
NORUN: 1
aarch64-linux-android:
TARGET: aarch64-linux-android
STDARCH_DISABLE_ASSERT_INSTR: 1
#powerpc-unknown-linux-gnu:
# TARGET: powerpc-unknown-linux-gnu
# STDARCH_DISABLE_ASSERT_INSTR: 1
#powerpc64-unknown-linux-gnu:
# TARGET: powerpc64-unknown-linux-gnu
# STDARCH_DISABLE_ASSERT_INSTR: 1
nvptx64-nvidia-cuda:
TARGET: nvptx64-nvidia-cuda
NORUN: 1
NOSTD: 1
thumbv6m-none-eabi:
TARGET: thumbv6m-none-eabi
NORUN: 1
NOSTD: 1
NO_DOCKER: 1
thumbv7m-none-eabi:
TARGET: thumbv7m-none-eabi
NORUN: 1
NOSTD: 1
NO_DOCKER: 1
thumbv7em-none-eabi:
TARGET: thumbv7em-none-eabi
NORUN: 1
NOSTD: 1
NO_DOCKER: 1
thumbv7em-none-eabihf:
TARGET: thumbv7em-none-eabihf
NORUN: 1
NOSTD: 1
NO_DOCKER: 1
- job: DockerOSX64
pool:
vmImage: macos-10.14
steps:
- template: azure-install-rust.yml
- bash: sh ./ci/run.sh $TARGET
displayName: Execute run.sh
strategy:
matrix:
x86_64-apple-darwin:
TARGET: x86_64-apple-darwin
NO_DOCKER: 1
- job: DockerOSX32
pool:
vmImage: macos-10.13
steps:
- template: azure-install-rust.yml
- bash: sh ./ci/run.sh $TARGET
displayName: Execute run.sh
strategy:
matrix:
i686-apple-darwin:
TARGET: i686-apple-darwin
NO_DOCKER: 1
- job: Windows
pool:
vmImage: vs2017-win2016
steps:
- template: azure-install-rust.yml
- bash: sh ./ci/run.sh $TARGET
displayName: Execute run.sh
strategy:
matrix:
x86_64-pc-windows-msvc:
TARGET: x86_64-pc-windows-msvc
# FIXME:
# Disassembly no implemented for the
# following targets:
# x86_64-pc-windows-gnu:
# TARGET: x86_64-pc-windows-gnu
#i686-pc-windows-gnu:
# TARGET: i686-pc-windows-gnu
#i686-pc-windows-msvc:
# TARGET: i686-pc-windows-msvc
- job: StyleAndDocs
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
- script: sh ci/style.sh
displayName: Check style
- script: sh ci/dox.sh
displayName: Generate documentation
- template: azure-configs/static-websites.yml@rustinfra
parameters:
deploy_dir: target/doc
variables:
CI: 1
- job: AutomaticVerification
dependsOn: StyleAndDocs
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
- script: cargo test --manifest-path crates/stdarch-verify/Cargo.toml
displayName: Automatic verification
- job: EnvOverride
dependsOn: StyleAndDocs
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
- script: RUST_STD_DETECT_UNSTABLE=avx cargo test --features=std_detect_env_override --manifest-path crates/std_detect/Cargo.toml env_override_no_avx
displayName: std_detect env override
# - job: GameBoyAdvance
# dependsOn: StyleAndDocs
# pool:
# vmImage: ubuntu-16.04
# steps:
# - template: azure-install-rust.yml
# - script: rustup component add rust-src
# displayName: Add rust-src
# - script: (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild)
# displayName: Add cargo-xbuild
# Obtain the devkitPro tools, using `target/` as a temp directory. This
# is required because we need to use their linker. `lld` uses the `BLX`
# instruction, which was not available in thumb state code until ARMv5.
# - script: |
# mkdir -p target
# cd target
# wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
# sudo dpkg -i devkitpro-pacman.deb
# sudo dkp-pacman -Sy
# sudo dkp-pacman -Syu
# sudo dkp-pacman -S -v --noconfirm gba-tools devkitARM
# export PATH="$PATH:/opt/devkitpro/devkitARM/bin"
# export PATH="$PATH:/opt/devkitpro/tools/bin"
# cd ..
# # Pull the target spec up into the current directory and then build
# mv ci/gba.json gba.json
# cargo xbuild -p core_arch --target gba.json
# variables:
# NORUN: 1
# NOSTD: 1
# NO_DOCKER: 1

8
library/stdarch/ci/style.sh Normal file → Executable file
View file

@ -8,10 +8,10 @@ if rustup component add rustfmt-preview ; then
cargo fmt --all -- --check
fi
if rustup component add clippy-preview ; then
cargo clippy -V
cargo clippy --all -- -D clippy::pedantic
fi
# if rustup component add clippy-preview ; then
# cargo clippy -V
# cargo clippy --all -- -D clippy::pedantic
# fi
if shellcheck --version ; then
shellcheck -e SC2103 ci/*.sh