diff --git a/.github/workflows/before_deploy.sh b/.github/workflows/before_deploy.sh new file mode 100755 index 000000000..687cb5b03 --- /dev/null +++ b/.github/workflows/before_deploy.sh @@ -0,0 +1,36 @@ +set -ex + +main() { + local tag=$(git tag --points-at HEAD) + local src=$(pwd) \ + stage= + + if [ "$OS_NAME" = "macOS-latest" ]; then + stage=$(mktemp -d -t tmp) + else + stage=$(mktemp -d) + fi + + (cd capi/bind_gen && cargo run) + + cp -r capi/bindings $stage/ + cp target/$TARGET/release/livesplit_core.dll $stage/livesplit_core.dll 2>/dev/null || : + cp target/$TARGET/release/livesplit_core.lib $stage/livesplit_core.lib 2>/dev/null || : + cp target/$TARGET/release/liblivesplit_core.a $stage/liblivesplit_core.a 2>/dev/null || : + cp target/$TARGET/release/liblivesplit_core.so $stage/liblivesplit_core.so 2>/dev/null || : + cp target/$TARGET/release/livesplit*.js* $stage/. 2>/dev/null || : + cp target/$TARGET/release/deps/*.wasm $stage/livesplit.wasm 2>/dev/null || : + cp target/$TARGET/release/liblivesplit_core.dylib $stage/liblivesplit_core.dylib 2>/dev/null || : + + cd $stage + if [ "$OS_NAME" = "windows-latest" ]; then + 7z a $src/livesplit-core-$tag-$TARGET.zip * + else + tar czf $src/livesplit-core-$tag-$TARGET.tar.gz * + fi + cd $src + + rm -rf $stage +} + +main diff --git a/.github/workflows/build_shared.sh b/.github/workflows/build_shared.sh new file mode 100644 index 000000000..f236d60e7 --- /dev/null +++ b/.github/workflows/build_shared.sh @@ -0,0 +1,16 @@ +set -ex + +main() { + local cargo=cross + if [ "$SKIP_CROSS" = "skip" ]; then + cargo=cargo + fi + local release_flag="" + if [ "$IS_DEPLOY" = "true" ]; then + release_flag="--release" + fi + + $cargo build -p cdylib --target $TARGET $release_flag +} + +main diff --git a/.github/workflows/build_static.sh b/.github/workflows/build_static.sh new file mode 100644 index 000000000..b80d780d5 --- /dev/null +++ b/.github/workflows/build_static.sh @@ -0,0 +1,31 @@ +set -ex + +main() { + local cargo=cross + if [ "$SKIP_CROSS" = "skip" ]; then + cargo=cargo + fi + local release_flag="" + if [ "$IS_DEPLOY" = "true" ]; then + release_flag="--release" + fi + + case $TARGET in + asmjs-unknown-emscripten) + $cargo build -p livesplit --target $TARGET --release + ;; + wasm32-unknown-emscripten) + rm target/wasm32-unknown-emscripten/release/deps/*.wasm 2>/dev/null || : + rm target/wasm32-unknown-emscripten/release/deps/*.js 2>/dev/null || : + $cargo build -p livesplit --target $TARGET --release + ;; + wasm32-unknown-unknown) + $cargo build -p cdylib --target $TARGET --release + ;; + *) + $cargo build -p staticlib --target $TARGET $release_flag + ;; + esac +} + +main diff --git a/.github/workflows/install.sh b/.github/workflows/install.sh new file mode 100644 index 000000000..01e4bb755 --- /dev/null +++ b/.github/workflows/install.sh @@ -0,0 +1,33 @@ +set -ex + +main() { + local target= + if [ "$OS_NAME" = "ubuntu-latest" ]; then + target=x86_64-unknown-linux-musl + sort=sort + else + target=x86_64-apple-darwin + sort=gsort + fi + + # This fetches latest stable release + # local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ + # | cut -d/ -f3 \ + # | grep -E '^v[0.1.0-9.]+$' \ + # | $sort --version-sort \ + # | tail -n1) + + # FIXME: We use a custom pre-release version that works with GitHub Actions. + # Also don't forget to also change back from CryZe/cross down there. + # https://github.com/LiveSplit/livesplit-core/issues/237 + local tag=v0.1.16-pre + + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- \ + --force \ + --git CryZe/cross \ + --tag $tag \ + --target $target +} + +main diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..0ac28bace --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,481 @@ +name: Rust + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + label: + # Web + - wasm32 emscripten + - wasm32 + + # Windows + - 1 Windows aarch64 + - 1 Windows i586 + - 1 Windows i686 + - 1 Windows x86_64 + - 1 Windows i686 gnu + - 1 Windows x86_64 gnu + + # Linux + - Linux i586 + - Linux i586 musl + - Linux i686 + - Linux i686 musl + - Linux x86_64 + - Linux x86_64 musl + - Linux x86_64 gnux32 + - Linux arm + - Linux arm musl + - Linux arm Hardware Float + - Linux arm musl Hardware Float + - Linux armv5te + - Linux armv5te musl + - Linux armv7 Hardware Float + - Linux armv7 musl Hardware Float + - Linux aarch64 + - Linux mips + - Linux mips64 + - Linux mips64el + - Linux mipsel + - Linux mipsel musl + # Unstable + # - env: TARGET=mipsisa32r6-unknown-linux-gnu + # - env: TARGET=mipsisa32r6el-unknown-linux-gnu + # - env: TARGET=mipsisa64r6-unknown-linux-gnuabi64 + # - env: TARGET=mipsisa64r6el-unknown-linux-gnuabi64 + - Linux powerpc + - Linux powerpc64 + - Linux powerpc64le + - Linux s390x + - Linux sparc64 + + # macOS + # 32-bit macOS is deprecated and doesn't build: + # https://github.com/CryZe/livesplit-core/runs/220089673 + # - macOS i686 + - macOS x86_64 + + # iOS + - iOS aarch64 + - iOS armv7 + - iOS armv7s + - iOS i386 + - iOS x86_64 + + # Android + - Android i686 + - Android x86_64 + - Android arm + - Android armv7 + - Android aarch64 + + # *BSD + # - i686-unknown-freebsd DISABLE_TESTS=1 + # - x86_64-unknown-freebsd DISABLE_TESTS=1 + - NetBSD x86_64 + + # Solaris + - Solaris x86_64 + # weird error + # https://travis-ci.org/LiveSplit/livesplit-core/jobs/327011754 + # - env: TARGET=sparcv9-sun-solaris + + # Testing other channels + - 1 Windows Beta + - 1 Windows Nightly + - 1 Windows Beta gnu + - 1 Windows Nightly gnu + - Linux Beta + - Linux Nightly + - macOS Beta + - macOS Nightly + + include: + # Web + - label: wasm32 emscripten + target: wasm32-unknown-emscripten + os: ubuntu-latest + toolchain: nightly + tests: skip + dylib: skip + release_anyway: true + + - label: wasm32 + target: wasm32-unknown-unknown + os: ubuntu-latest + tests: skip + dylib: skip + install_target: true + release_anyway: true + + # Windows + - label: 1 Windows aarch64 + target: aarch64-pc-windows-msvc + os: windows-latest + cross: skip + tests: skip + install_target: true + + - label: 1 Windows i586 + target: i586-pc-windows-msvc + os: windows-latest + cross: skip + install_target: true + + - label: 1 Windows i686 + target: i686-pc-windows-msvc + os: windows-latest + cross: skip + install_target: true + + - label: 1 Windows x86_64 + target: x86_64-pc-windows-msvc + os: windows-latest + cross: skip + + - label: 1 Windows i686 gnu + target: i686-pc-windows-gnu + toolchain: stable-i686-pc-windows-gnu + os: windows-latest + cross: skip + install_target: true + + - label: 1 Windows x86_64 gnu + target: x86_64-pc-windows-gnu + toolchain: stable-x86_64-pc-windows-gnu + os: windows-latest + cross: skip + install_target: true + + # Linux + - label: Linux i586 + target: i586-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux i586 musl + target: i586-unknown-linux-musl + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux i686 + target: i686-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux i686 musl + target: i686-unknown-linux-musl + os: ubuntu-latest + dylib: skip + + - label: Linux x86_64 + target: x86_64-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux x86_64 musl + target: x86_64-unknown-linux-musl + os: ubuntu-latest + dylib: skip + + - label: Linux x86_64 gnux32 + target: x86_64-unknown-linux-gnux32 + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux arm + target: arm-unknown-linux-gnueabi + os: ubuntu-latest + tests: skip + + - label: Linux arm musl + target: arm-unknown-linux-musleabi + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux arm Hardware Float + target: arm-unknown-linux-gnueabihf + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux arm musl Hardware Float + target: arm-unknown-linux-musleabihf + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux armv5te + target: armv5te-unknown-linux-gnueabi + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux armv5te musl + target: armv5te-unknown-linux-musleabi + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux armv7 Hardware Float + target: armv7-unknown-linux-gnueabihf + os: ubuntu-latest + + - label: Linux armv7 musl Hardware Float + target: armv7-unknown-linux-musleabihf + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux aarch64 + target: aarch64-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux mips + target: mips-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux mips64 + target: mips64-unknown-linux-gnuabi64 + os: ubuntu-latest + + - label: Linux mips64el + target: mips64el-unknown-linux-gnuabi64 + os: ubuntu-latest + + - label: Linux mipsel + target: mipsel-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux mipsel musl + target: mipsel-unknown-linux-musl + os: ubuntu-latest + tests: skip + dylib: skip + + - label: Linux powerpc + target: powerpc-unknown-linux-gnu + os: ubuntu-latest + tests: skip + + - label: Linux powerpc64 + target: powerpc64-unknown-linux-gnu + os: ubuntu-latest + + - label: Linux powerpc64le + target: powerpc64le-unknown-linux-gnu + os: ubuntu-latest + # FIXME: The tests should run, but cross v0.1.15 is broken + tests: skip + + - label: Linux s390x + target: s390x-unknown-linux-gnu + os: ubuntu-latest + tests: skip + + - label: Linux sparc64 + target: sparc64-unknown-linux-gnu + os: ubuntu-latest + tests: skip + + # macOS + # - label: macOS i686 + # target: i686-apple-darwin + # toolchain: stable-i686-apple-darwin + # os: macOS-latest + # cross: skip + + - label: macOS x86_64 + target: x86_64-apple-darwin + os: macOS-latest + cross: skip + + # iOS + - label: iOS aarch64 + target: aarch64-apple-ios + os: macOS-latest + cross: skip + dylib: skip + tests: skip + install_target: true + + - label: iOS armv7 + target: armv7-apple-ios + os: macOS-latest + cross: skip + dylib: skip + tests: skip + install_target: true + + - label: iOS armv7s + target: armv7s-apple-ios + os: macOS-latest + cross: skip + dylib: skip + tests: skip + install_target: true + + - label: iOS i386 + target: i386-apple-ios + os: macOS-latest + cross: skip + dylib: skip + tests: skip + install_target: true + + - label: iOS x86_64 + target: x86_64-apple-ios + os: macOS-latest + cross: skip + dylib: skip + tests: skip + install_target: true + + # Android + - label: Android i686 + target: i686-linux-android + os: ubuntu-latest + tests: skip + + - label: Android x86_64 + target: x86_64-linux-android + os: ubuntu-latest + + - label: Android arm + target: arm-linux-androideabi + os: ubuntu-latest + tests: skip + + - label: Android armv7 + target: armv7-linux-androideabi + os: ubuntu-latest + tests: skip + + - label: Android aarch64 + target: aarch64-linux-android + os: ubuntu-latest + tests: skip + + # *BSD + - label: NetBSD x86_64 + target: x86_64-unknown-netbsd + os: ubuntu-latest + tests: skip + + # Solaris + - label: Solaris x86_64 + target: x86_64-sun-solaris + os: ubuntu-latest + tests: skip + dylib: skip + + # Testing other channels + - label: 1 Windows Beta + target: x86_64-pc-windows-msvc + os: windows-latest + toolchain: beta + cross: skip + + - label: 1 Windows Nightly + target: x86_64-pc-windows-msvc + os: windows-latest + toolchain: nightly + cross: skip + + - label: 1 Windows Beta gnu + target: x86_64-pc-windows-gnu + toolchain: beta-x86_64-pc-windows-gnu + os: windows-latest + cross: skip + install_target: true + + - label: 1 Windows Nightly gnu + target: x86_64-pc-windows-gnu + toolchain: nightly-x86_64-pc-windows-gnu + os: windows-latest + cross: skip + install_target: true + + - label: Linux Beta + target: x86_64-unknown-linux-gnu + os: ubuntu-latest + toolchain: beta + + - label: Linux Nightly + target: x86_64-unknown-linux-gnu + os: ubuntu-latest + toolchain: nightly + + - label: macOS Beta + target: x86_64-apple-darwin + os: macOS-latest + toolchain: beta + cross: skip + + - label: macOS Nightly + target: x86_64-apple-darwin + os: macOS-latest + toolchain: nightly + cross: skip + + steps: + - name: Checkout Commit + uses: actions/checkout@v1 + + - name: Install Rust + uses: hecrj/setup-rust-action@v1 + with: + rust-version: ${{ matrix.toolchain || 'stable' }} + + - name: Install Target + if: matrix.install_target != '' + run: rustup target add ${{ matrix.target }} + + - name: Install cross + if: matrix.cross == '' + run: sh .github/workflows/install.sh + env: + OS_NAME: ${{ matrix.os }} + + - name: Build Static Library + run: sh .github/workflows/build_static.sh + env: + TARGET: ${{ matrix.target }} + SKIP_CROSS: ${{ matrix.cross }} + IS_DEPLOY: ${{ startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) }} + + - name: Build Shared Library + if: matrix.dylib == '' + run: sh .github/workflows/build_shared.sh + env: + TARGET: ${{ matrix.target }} + SKIP_CROSS: ${{ matrix.cross }} + IS_DEPLOY: ${{ startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) }} + + - name: Test + if: matrix.tests == '' + run: sh .github/workflows/test.sh + env: + TARGET: ${{ matrix.target }} + SKIP_CROSS: ${{ matrix.cross }} + + - name: Prepare Release + if: startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) + shell: bash + run: .github/workflows/before_deploy.sh + env: + OS_NAME: ${{ matrix.os }} + TARGET: ${{ matrix.target }} + + - name: Release + if: startsWith(github.ref, 'refs/tags/') && (matrix.release_anyway != '' || !(startsWith(matrix.toolchain, 'nightly') || startsWith(matrix.toolchain, 'beta'))) + uses: softprops/action-gh-release@v1 + with: + files: livesplit-core-*.* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh new file mode 100644 index 000000000..35f602a8f --- /dev/null +++ b/.github/workflows/test.sh @@ -0,0 +1,13 @@ +set -ex + +main() { + local cargo=cross + if [ "$SKIP_CROSS" = "skip" ]; then + cargo=cargo + fi + + $cargo test -p livesplit-core --all-features --target $TARGET + $cargo test -p livesplit-core --no-default-features --target $TARGET +} + +main diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 52a1de3d7..000000000 --- a/.travis.yml +++ /dev/null @@ -1,160 +0,0 @@ -# Based on the "trust" template v0.1.1 -# https://github.com/japaric/trust/tree/v0.1.1 - -dist: trusty -language: rust -services: docker -# sudo: required - -env: - global: - - CRATE_NAME=livesplit-core - - RUST_BACKTRACE=1 - -matrix: - allow_failures: - # Failing for now until this is fixed: - # https://github.com/LiveSplit/livesplit-core/issues/164 - - env: TARGET=asmjs-unknown-emscripten - rust: nightly - - env: TARGET=wasm32-unknown-emscripten - rust: nightly - - include: - # no-std - # - env: TARGET=x86_64-unknown-dragonfly - # - env: TARGET=thumbv6m-none-eabi - # - env: TARGET=thumbv7em-none-eabi - # - env: TARGET=thumbv7m-none-eab - # - env: TARGET=thumbv7em-none-eabihf - - # Web - - env: TARGET=asmjs-unknown-emscripten - rust: nightly - - env: TARGET=wasm32-unknown-emscripten - rust: nightly - - env: TARGET=wasm32-unknown-unknown - rust: nightly - - # Linux - - env: TARGET=i586-unknown-linux-gnu - - env: TARGET=i586-unknown-linux-musl NO_DYLIB=1 DISABLE_TESTS=1 - - env: TARGET=i686-unknown-linux-gnu - - env: TARGET=i686-unknown-linux-musl NO_DYLIB=1 - - env: TARGET=x86_64-unknown-linux-gnu - - env: TARGET=x86_64-unknown-linux-musl NO_DYLIB=1 - - env: TARGET=x86_64-unknown-linux-gnux32 DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=arm-unknown-linux-gnueabi DISABLE_TESTS=1 - - env: TARGET=arm-unknown-linux-musleabi DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=arm-unknown-linux-gnueabihf DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=arm-unknown-linux-musleabihf DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=armv5te-unknown-linux-gnueabi DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=armv5te-unknown-linux-musleabi DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=armv7-unknown-linux-gnueabihf - - env: TARGET=armv7-unknown-linux-musleabihf DISABLE_TESTS=1 NO_DYLIB=1 - - env: TARGET=aarch64-unknown-linux-gnu - - env: TARGET=mips-unknown-linux-gnu - - env: TARGET=mips64-unknown-linux-gnuabi64 - - env: TARGET=mips64el-unknown-linux-gnuabi64 - - env: TARGET=mipsel-unknown-linux-gnu - - env: TARGET=mipsel-unknown-linux-musl DISABLE_TESTS=1 NO_DYLIB=1 - # Unstable - # - env: TARGET=mipsisa32r6-unknown-linux-gnu - # - env: TARGET=mipsisa32r6el-unknown-linux-gnu - # - env: TARGET=mipsisa64r6-unknown-linux-gnuabi64 - # - env: TARGET=mipsisa64r6el-unknown-linux-gnuabi64 - - env: TARGET=powerpc-unknown-linux-gnu DISABLE_TESTS=1 - - env: TARGET=powerpc64-unknown-linux-gnu - - env: TARGET=powerpc64le-unknown-linux-gnu - - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1 - - env: TARGET=sparc64-unknown-linux-gnu DISABLE_TESTS=1 - - # iOS - - env: TARGET=aarch64-apple-ios DISABLE_TESTS=1 NO_DYLIB=1 - os: osx - - env: TARGET=armv7-apple-ios DISABLE_TESTS=1 NO_DYLIB=1 - os: osx - - env: TARGET=armv7s-apple-ios DISABLE_TESTS=1 NO_DYLIB=1 - os: osx - - env: TARGET=i386-apple-ios DISABLE_TESTS=1 NO_DYLIB=1 - os: osx - - env: TARGET=x86_64-apple-ios DISABLE_TESTS=1 NO_DYLIB=1 - os: osx - - # Android - - env: TARGET=i686-linux-android DISABLE_TESTS=1 - - env: TARGET=x86_64-linux-android - - env: TARGET=arm-linux-androideabi DISABLE_TESTS=1 - - env: TARGET=armv7-linux-androideabi DISABLE_TESTS=1 - - env: TARGET=aarch64-linux-android DISABLE_TESTS=1 - - # OSX - - env: TARGET=i686-apple-darwin - os: osx - - env: TARGET=x86_64-apple-darwin - os: osx - - # *BSD - - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1 - - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 - - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1 - - # Solaris - - env: TARGET=x86_64-sun-solaris DISABLE_TESTS=1 NO_DYLIB=1 - # weird error - # https://travis-ci.org/LiveSplit/livesplit-core/jobs/327011754 - # - env: TARGET=sparcv9-sun-solaris - - # Testing other channels - - env: TARGET=x86_64-unknown-linux-gnu - rust: beta - - env: TARGET=x86_64-apple-darwin - os: osx - rust: beta - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - - env: TARGET=x86_64-apple-darwin - os: osx - rust: nightly - -before_install: - - set -e - - rustup self update - -install: - - sh ci/install.sh - - source ~/.cargo/env || true - -script: - - bash ci/script.sh - -after_script: set +e - -before_deploy: - - sh ci/before_deploy.sh - -deploy: - api_key: - secure: "pKwa9SjJVenEk2MwFh3pVv6MO+Z//Ng4RG6ZvMxHDsfuElFpU6obMs6dvK0tUFNBQMayXxMhJMKz2ZD+eiOtyOmJY218QxsfkyqazwakvXLasrGtKtyp7pzkNHaiE8o73Mr+9MudUiqWIg8y+X1lTV1A5GN+i1jprGZip0RV+qHeZtpNkYjX/99+Xh5Z/Wp9rCcxO+flyWjbpA151Bqx/QX88usCpIXEH9uJOHjQd/VHuPQoxOw6RiyAleF1EfHfor+/0uHbHNHjulm4U5hCjAoQGm0RppA1rMBg5y36lXLg5Ophz+PREzJl6Xj9rW2ExPRkHYqrkmfUKAjNeJQVNnN1xu84ngND5YRUzsDBk1t3XDvY1DSdqosSsjSZ99XvJrrbTFoF12WpKBKFCaTQHp26Fn5oNh9I/ZNW7I9Jzqga2PubxCiSR9L2DtCaw5Y2nKFn54+VMF4U4pa6fnCsw2o72qTFkpLwba+oFnrUT+dXoUpvPMcBeZSb4HuV0LKfkN2e3WHPZKRbJAFfmjVVJ083HYIpp7lohBKFNMtbrcXNdAtD0y2xb+SlzKo/ZIQnTJw3lW5+n4PCzso1OlIwUiEx0ZN2V3jHC6ZOrqMNdnFn3NZq4aOBzQdi493gPnhIiJlyywEn93UXTyTXirpsNL99GlUo3iX6nbh8LbgAjQY=" - file_glob: true - file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.* - on: - condition: $TRAVIS_RUST_VERSION == 'stable' || $TARGET = 'asmjs-unknown-emscripten' || $TARGET == 'wasm32-unknown-emscripten' || $TARGET == 'wasm32-unknown-unknown' - tags: true - provider: releases - skip_cleanup: true - -cache: cargo -before_cache: - # Travis can't cache files that are not readable by "others" - - chmod -R a+r $HOME/.cargo - -branches: - only: - # release tags - - /^v\d+\.\d+\.\d+.*$/ - - master - -notifications: - email: - on_success: never diff --git a/Cargo.toml b/Cargo.toml index 340523f3f..70f97c51b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,8 +24,7 @@ edition = "2018" all-features = true [badges] -travis-ci = { repository = "LiveSplit/livesplit-core" } -appveyor = { repository = "CryZe/livesplit-core" } +# FIXME: Add GitHub Actions badge [profile.release] lto = true diff --git a/README.md b/README.md index 281a94512..3afee4e97 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # LiveSplit livesplit-core -[![Build Status](https://travis-ci.org/LiveSplit/livesplit-core.svg?branch=master)](https://travis-ci.org/LiveSplit/livesplit-core) -[![Build status](https://ci.appveyor.com/api/projects/status/bvv4un099w94kari/branch/master?svg=true)](https://ci.appveyor.com/project/CryZe/livesplit-core/branch/master) +[![Build Status](https://github.com/LiveSplit/livesplit-core/workflows/Rust/badge.svg)](https://github.com/LiveSplit/livesplit-core/actions) [![crates.io](https://img.shields.io/crates/v/livesplit-core.svg)](https://crates.io/crates/livesplit-core) [![npm](https://img.shields.io/npm/v/livesplit-core.svg)](https://www.npmjs.com/package/livesplit-core) [![docs.rs](https://docs.rs/livesplit-core/badge.svg)](https://docs.rs/livesplit-core/) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e5fd8419c..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,93 +0,0 @@ -# Based on the "trust" template v0.1.1 -# https://github.com/japaric/trust/tree/v0.1.1 - -environment: - global: - RUST_VERSION: stable - CRATE_NAME: livesplit-core - - matrix: - # Aarch64 - - TARGET: aarch64-pc-windows-msvc - SKIP_TESTS: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - RUST_VERSION: stable-x86_64-pc-windows-msvc - - # MSVC - - TARGET: i586-pc-windows-msvc - RUST_VERSION: stable-i686-pc-windows-msvc - - TARGET: i686-pc-windows-msvc - - TARGET: x86_64-pc-windows-msvc - - # MinGW - - TARGET: i686-pc-windows-gnu - - TARGET: x86_64-pc-windows-gnu - - # Testing other channels - - TARGET: x86_64-pc-windows-gnu - RUST_VERSION: beta - - TARGET: x86_64-pc-windows-msvc - RUST_VERSION: beta - - TARGET: x86_64-pc-windows-gnu - RUST_VERSION: nightly - - TARGET: x86_64-pc-windows-msvc - RUST_VERSION: nightly - -matrix: - allow_failures: - - RUST_VERSION: nightly - - RUST_VERSION: beta - -install: - - ps: >- - choco install curl - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustup target install %TARGET% - - rustc -Vv - - cargo -V - -test_script: - # we don't run the "test phase" when doing deploys - - if [%APPVEYOR_REPO_TAG%]==[false] ( - cargo build -p staticlib --target %TARGET% && - cargo build -p cdylib --target %TARGET% && - if [%SKIP_TESTS%] neq [true] ( - cargo test -p livesplit-core --all-features --target %TARGET% && - cargo test -p livesplit-core --no-default-features --target %TARGET% - ) - ) - -before_deploy: - - cargo rustc -p staticlib --target %TARGET% --release - - cargo rustc -p cdylib --target %TARGET% --release - - ps: ci\before_deploy.ps1 - -deploy: - artifact: /.*\.zip/ - auth_token: - secure: zZGfrpCR/0TmHcXPwar4hOx6pZeq3C9Wwf/g62pvf135tAwJIVpuZHJjB0sAAd2M - description: '' - on: - RUST_VERSION: /stable.*/ - appveyor_repo_tag: true - provider: GitHub - -# Don't cache on appveyor, as it seems to blow the disk storage every now and then. -# cache: -# - C:\Users\appveyor\.cargo\registry -# - target - -branches: - only: - # Release tags - - /^v\d+\.\d+\.\d+.*$/ - - master - -notifications: - - provider: Email - on_build_success: false - -# disable automatic builds -build: false diff --git a/ci/before_deploy.ps1 b/ci/before_deploy.ps1 deleted file mode 100644 index 9cf60f8cb..000000000 --- a/ci/before_deploy.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -# This script takes care of packaging the build artifacts that will go in the -# release zipfile - -$SRC_DIR = $PWD.Path -$STAGE = [System.Guid]::NewGuid().ToString() - -cd capi\bind_gen -cargo run -cd ..\.. - -Set-Location $ENV:Temp -New-Item -Type Directory -Name $STAGE -Set-Location $STAGE - -$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" - -Copy-Item "$SRC_DIR\capi\bindings" '.\' -recurse -Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\livesplit_core.dll" '.\livesplit_core.dll' -Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\livesplit_core.lib" '.\livesplit_core.lib' - -7z a "$ZIP" * - -Push-AppveyorArtifact "$ZIP" - -Remove-Item *.* -Force -Set-Location .. -Remove-Item $STAGE -Set-Location $SRC_DIR diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh deleted file mode 100644 index 0e8308225..000000000 --- a/ci/before_deploy.sh +++ /dev/null @@ -1,62 +0,0 @@ -# This script takes care of building your crate and packaging it for release - -set -ex - -main() { - local src=$(pwd) \ - stage= - - case $TRAVIS_OS_NAME in - linux) - stage=$(mktemp -d) - ;; - osx) - stage=$(mktemp -d -t tmp) - ;; - esac - - test -f Cargo.lock || cargo generate-lockfile - - case $TARGET in - asmjs-unknown-emscripten) - cross build -p livesplit --target $TARGET --release - ;; - wasm32-unknown-emscripten) - rm target/$TARGET/release/deps/*.wasm 2>/dev/null || : - rm target/$TARGET/release/deps/*.js 2>/dev/null || : - cross build -p livesplit --target $TARGET --release - ;; - wasm32-unknown-unknown) - cross build -p cdylib --target $TARGET --release - ;; - *) - cross rustc -p staticlib --target $TARGET --release - if [ -z $NO_DYLIB ]; then - cross rustc -p cdylib --target $TARGET --release - fi - ;; - esac - - (cd capi/bind_gen && cargo run) - - cp -r capi/bindings $stage/ - case $TRAVIS_OS_NAME in - linux) - cp target/$TARGET/release/liblivesplit_core.so $stage/liblivesplit_core.so 2>/dev/null || : - cp target/$TARGET/release/livesplit*.js* $stage/. 2>/dev/null || : - cp target/$TARGET/release/deps/*.wasm $stage/livesplit.wasm 2>/dev/null || : - ;; - osx) - cp target/$TARGET/release/liblivesplit_core.dylib $stage/liblivesplit_core.dylib 2>/dev/null || : - ;; - esac - cp target/$TARGET/release/liblivesplit_core.a $stage/liblivesplit_core.a 2>/dev/null || : - - cd $stage - tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * - cd $src - - rm -rf $stage -} - -main diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 9dbcc967f..000000000 --- a/ci/install.sh +++ /dev/null @@ -1,86 +0,0 @@ -set -ex - -main() { - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - else - target=x86_64-apple-darwin - sort=gsort # for `sort --sort-version`, from brew's coreutils. - fi - - case $TARGET in - aarch64-apple-ios) - rustup target install $TARGET - ;; - armv7-apple-ios) - rustup target install $TARGET - ;; - armv7s-apple-ios) - rustup target install $TARGET - ;; - i386-apple-ios) - rustup target install $TARGET - ;; - x86_64-apple-ios) - rustup target install $TARGET - ;; - wasm32-unknown-unknown) - rustup target install $TARGET - ;; - x86_64-unknown-linux-gnux32) - rustup target install $TARGET - ;; - i586-unknown-linux-musl) - rustup target install $TARGET - ;; - arm-unknown-linux-gnueabihf) - rustup target install $TARGET - ;; - arm-unknown-linux-musleabihf) - rustup target install $TARGET - ;; - armv5te-unknown-linux-gnueabi) - rustup target install $TARGET - ;; - armv5te-unknown-linux-musleabi) - rustup target install $TARGET - ;; - mipsel-unknown-linux-musl) - rustup target install $TARGET - ;; - mipsisa32r6-unknown-linux-gnu) - rustup target install $TARGET - ;; - mipsisa32r6el-unknown-linux-gnu) - rustup target install $TARGET - ;; - mipsisa64r6-unknown-linux-gnuabi64) - rustup target install $TARGET - ;; - mipsisa64r6el-unknown-linux-gnuabi64) - rustup target install $TARGET - ;; - esac - - # This fetches latest stable release - # local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - # | cut -d/ -f3 \ - # | grep -E '^v[0.1.0-9.]+$' \ - # | $sort --version-sort \ - # | tail -n1) - - # FIXME: We are staying on 0.1.14 until cross works again for the targets that we compile to. - # https://github.com/LiveSplit/livesplit-core/issues/237 - local tag=v0.1.14 - - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index f031b7bbf..000000000 --- a/ci/script.sh +++ /dev/null @@ -1,45 +0,0 @@ -# This script takes care of testing your crate - -set -ex - -main() { - case $TARGET in - asmjs-unknown-emscripten) - cross build -p livesplit --target $TARGET --release - return - ;; - wasm32-unknown-emscripten) - rm target/wasm32-unknown-emscripten/release/deps/*.wasm 2>/dev/null || : - rm target/wasm32-unknown-emscripten/release/deps/*.js 2>/dev/null || : - cross build -p livesplit --target $TARGET --release - return - ;; - wasm32-unknown-unknown) - cross build -p cdylib --target $TARGET --release - return - ;; - esac - - cross build -p staticlib --target $TARGET - # cross build -p staticlib --target $TARGET --release - if [ -z $NO_DYLIB ]; then - cross build -p cdylib --target $TARGET - # cross build -p cdylib --target $TARGET --release - fi - - if [ ! -z $DISABLE_TESTS ]; then - return - fi - - cross test -p livesplit-core --all-features --target $TARGET - cross test -p livesplit-core --no-default-features --target $TARGET - # cross test -p livesplit-core --target $TARGET --release - - # cross run --target $TARGET - # cross run --target $TARGET --release -} - -# we don't run the "test phase" when doing deploys -if [ -z $TRAVIS_TAG ]; then - main -fi