From 2da24089de5c5634c04f57d12bdb5367d770e91f Mon Sep 17 00:00:00 2001 From: Osspial Date: Sun, 5 Jan 2020 14:13:05 -0500 Subject: [PATCH] Replace Appveyor and Travis with Github Actions (#1309) * Experiment with github actions * Only use stable for testing simplicity * Disable fail-fast * Never fail when rustup target add fails * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Split formatting check into separate job * Update and rename rust.yml to ci.yml * Attempt to add web support * Fix things * Fixings * The "I'm not familiar with YAML" update * The empty string update * Fix target interpolation * Add gcc-multilib on linux x86 * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Use correct host on Windows GNU * Update ci.yml * Update ci.yml * in my defense it was like 2 AM when I wrote this * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * try caching * Update ci.yml * Update ci.yml * Update on * Update ci.yml * Update ci.yml * Remove travis and appveyor testing * Cache entire cargo folder * Make cargo cache key more appropriately named * Reduce key collisions * Make key work * Add publish workflow and path qualifiers * Remove -f in cargo install cargo-web * continue-on-error for cargo web * ping * Try to shorten matrix * attempt two * attempt three * attempt four * Use bash * web feature formatting * ping --- .github/workflows/ci.yml | 107 ++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 18 ++++++ .travis.yml | 104 --------------------------------- appveyor.yml | 35 ----------- 4 files changed, 125 insertions(+), 139 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d552c4c1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,107 @@ +name: CI + +on: + pull_request: + paths: + - '**.rs' + - '**.toml' + - '.github/workflows/ci.yml' + push: + branches: [master] + paths: + - '**.rs' + - '**.toml' + - '.github/workflows/ci.yml' + +jobs: + Check_Formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: hecrj/setup-rust-action@v1 + with: + rust-version: stable + components: rustfmt + - name: Check Formatting + run: cargo +stable fmt --all -- --check + + Tests: + strategy: + fail-fast: false + matrix: + rust_version: [stable, nightly] + platform: + - { target: x86_64-pc-windows-msvc, os: windows-latest, } + - { target: i686-pc-windows-msvc, os: windows-latest, } + - { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu } + - { target: i686-pc-windows-gnu, os: windows-latest, host: -i686-pc-windows-gnu } + - { target: i686-unknown-linux-gnu, os: ubuntu-latest, } + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, } + - { target: x86_64-apple-darwin, os: macos-latest, } + - { target: x86_64-apple-ios, os: macos-latest, } + - { target: armv7-apple-ios, os: macos-latest, } + - { target: aarch64-apple-ios, os: macos-latest, } + # We're using Windows rather than Ubuntu to run the wasm tests because caching cargo-web + # doesn't currently work on Linux. + - { target: wasm32-unknown-unknown, os: windows-latest, features: stdweb, web: web } + - { target: wasm32-unknown-unknown, os: windows-latest, features: web-sys, web: web } + + env: + RUST_BACKTRACE: 1 + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0" + FEATURES: ${{ format(',{0}', matrix.platform.features ) }} + WEB: ${{ matrix.platform.web }} + + runs-on: ${{ matrix.platform.os }} + steps: + - uses: actions/checkout@v1 + # Used to cache cargo-web + - name: Cache cargo folder + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }} + + - uses: hecrj/setup-rust-action@v1 + with: + rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }} + targets: ${{ matrix.platform.target }} + + - name: Install GCC Multilib + if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686') + run: sudo apt-get update && sudo apt-get install gcc-multilib + - name: Install cargo-web + continue-on-error: true + if: contains(matrix.platform.target, 'wasm32') + run: cargo install cargo-web + + - name: Check documentation + shell: bash + if: matrix.platform.target != 'wasm32-unknown-unknown' + run: cargo doc --no-deps --target ${{ matrix.platform.target }} --features $FEATURES + + - name: Build + shell: bash + run: cargo $WEB build --verbose --target ${{ matrix.platform.target }} --features $FEATURES + + - name: Build tests + shell: bash + run: cargo $WEB test --no-run --verbose --target ${{ matrix.platform.target }} --features $FEATURES + - name: Run tests + shell: bash + if: (!contains(matrix.platform.target, 'ios') && !contains(matrix.platform.target, 'wasm32')) + run: cargo $WEB test --verbose --target ${{ matrix.platform.target }} --features $FEATURES + + + - name: Build with serde enabled + shell: bash + run: cargo $WEB build --verbose --target ${{ matrix.platform.target }} --features serde,$FEATURES + + - name: Build tests with serde enabled + shell: bash + run: cargo $WEB test --no-run --verbose --target ${{ matrix.platform.target }} --features serde,$FEATURES + - name: Run tests with serde enabled + shell: bash + if: (!contains(matrix.platform.target, 'ios') && !contains(matrix.platform.target, 'wasm32')) + run: cargo $WEB test --verbose --target ${{ matrix.platform.target }} --features serde,$FEATURES diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..eac13a0a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,18 @@ +name: Publish + +on: + push: + branches: [master] + paths: "Cargo.toml" + +jobs: + Publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: hecrj/setup-rust-action@v1 + with: + rust-version: stable + components: rustfmt + - name: Publish to crates.io + run: cargo publish --token ${{ secrets.cratesio_token }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 649b0106..00000000 --- a/.travis.yml +++ /dev/null @@ -1,104 +0,0 @@ -language: rust - -matrix: - include: - # Linux 32bit - - env: TARGET=i686-unknown-linux-gnu - os: linux - rust: nightly - addons: - apt: - # Cross compiler and cross compiled C libraries - packages: &i686_packages - - gcc-multilib - - env: TARGET=i686-unknown-linux-gnu - os: linux - rust: stable - addons: - apt: - packages: *i686_packages - - # Linux 64bit - - env: TARGET=x86_64-unknown-linux-gnu - os: linux - rust: nightly - - env: TARGET=x86_64-unknown-linux-gnu - os: linux - rust: stable - - # macOS - - env: TARGET=x86_64-apple-darwin - os: osx - rust: nightly - - env: TARGET=x86_64-apple-darwin - os: osx - rust: stable - - # iOS x86_64 - - env: TARGET=x86_64-apple-ios - os: osx - rust: nightly - - env: TARGET=x86_64-apple-ios - os: osx - rust: stable - - # iOS armv7 - - env: TARGET=armv7-apple-ios - os: osx - rust: nightly - - env: TARGET=armv7-apple-ios - os: osx - rust: stable - - # iOS arm64 - - env: TARGET=aarch64-apple-ios - os: osx - rust: nightly - - env: TARGET=aarch64-apple-ios - os: osx - rust: stable - - # wasm stdweb - - env: TARGET=wasm32-unknown-unknown WEB=web FEATURES=stdweb - os: linux - rust: stable - - env: TARGET=wasm32-unknown-unknown WEB=web FEATURES=stdweb - os: linux - rust: nightly - # wasm web-sys - - env: TARGET=wasm32-unknown-unknown FEATURES=web-sys - os: linux - rust: stable - - env: TARGET=wasm32-unknown-unknown FEATURES=web-sys - os: linux - rust: nightly - -install: - - rustup self update - - rustup target add $TARGET; true - - rustup toolchain install stable - - rustup component add rustfmt --toolchain stable - -script: - - cargo +stable fmt --all -- --check - # Ensure that the documentation builds properly. - - cargo doc --no-deps - # Install cargo-web to build stdweb - - if [[ $WEB = "web" ]]; then cargo install -f cargo-web; fi - # Build without serde then with serde - - if [[ -z "$FEATURES" ]]; then - cargo $WEB build --target $TARGET --verbose; - else - cargo $WEB build --target $TARGET --features $FEATURES --verbose; - fi - - cargo $WEB build --target $TARGET --features serde,$FEATURES --verbose - # Running iOS apps on macOS requires the Simulator so we skip that for now - # The web targets also don't support running tests - - if [[ $TARGET != *-apple-ios && $TARGET != wasm32-* ]]; then cargo test --target $TARGET --verbose; fi - - if [[ $TARGET != *-apple-ios && $TARGET != wasm32-* ]]; then cargo test --target $TARGET --features serde --verbose; fi - -after_success: - - | - [ $TRAVIS_BRANCH = master ] && - [ $TRAVIS_PULL_REQUEST = false ] && - cargo publish --token ${CRATESIO_TOKEN} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 20ee2cc7..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,35 +0,0 @@ -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - CHANNEL: stable - - TARGET: i686-pc-windows-msvc - CHANNEL: stable - - TARGET: x86_64-pc-windows-gnu - CHANNEL: stable - - TARGET: i686-pc-windows-gnu - CHANNEL: stable - - TARGET: x86_64-pc-windows-msvc - CHANNEL: nightly - - TARGET: i686-pc-windows-msvc - CHANNEL: nightly - - TARGET: x86_64-pc-windows-gnu - CHANNEL: nightly - - TARGET: i686-pc-windows-gnu - CHANNEL: nightly -matrix: - allow_failures: - - CHANNEL: nightly -install: - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init -yv --default-toolchain %CHANNEL% --default-host %TARGET% - - SET PATH=%PATH%;%USERPROFILE%\.cargo\bin - - SET PATH=%PATH%;C:\MinGW\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --verbose - - cargo test --features serde --verbose - - cargo doc --no-deps