summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Erik Rediger <janerik@fnordig.de>2021-01-05 20:39:27 +0100
committerJan-Erik Rediger <janerik@fnordig.de>2021-01-05 20:39:27 +0100
commit3580cba26d9d003a2f7648a8332c1b5da8320489 (patch)
treeaaf88003c8ea98ea71929cba3c0ebbde27eb2e73
parent5a74024e5842e9b926f458250271a7b72aab4e53 (diff)
Switch to GitHub Actions
-rw-r--r--.github/workflows/deploy.yml124
-rw-r--r--.github/workflows/tests.yml53
-rw-r--r--.travis.yml62
-rw-r--r--appveyor.yml66
-rw-r--r--ci/before_deploy.ps122
-rw-r--r--ci/before_deploy.sh31
-rw-r--r--ci/install.sh47
-rw-r--r--ci/script.sh18
8 files changed, 177 insertions, 246 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..c5bc3aa
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,124 @@
+# Based on https://github.com/starship/starship/blob/master/.github/workflows/deploy.yml
+
+name: Deploy
+on:
+ push:
+ tags:
+ - "*"
+
+env:
+ CRATE_NAME: mdbook-open-on-gh
+
+jobs:
+ # Build sources for every OS
+ github_build:
+ name: Build release binaries
+ strategy:
+ fail-fast: false
+ matrix:
+ target:
+ - x86_64-unknown-linux-gnu
+ - x86_64-unknown-linux-musl
+ - x86_64-apple-darwin
+ - x86_64-pc-windows-msvc
+ include:
+ - target: x86_64-unknown-linux-gnu
+ os: ubuntu-latest
+ name: x86_64-unknown-linux-gnu.tar.gz
+ - target: x86_64-unknown-linux-musl
+ os: ubuntu-latest
+ name: x86_64-unknown-linux-musl.tar.gz
+ - target: x86_64-apple-darwin
+ os: macOS-latest
+ name: x86_64-apple-darwin.tar.gz
+ - target: x86_64-pc-windows-msvc
+ os: windows-latest
+ name: x86_64-pc-windows-msvc.zip
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v2
+
+ # Cache files between builds
+ - name: Setup | Cache Cargo
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+
+ - name: Setup | Rust
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ override: true
+ profile: minimal
+ target: ${{ matrix.target }}
+
+ - name: Setup | musl tools
+ if: matrix.target == 'x86_64-unknown-linux-musl'
+ run: sudo apt install -y musl-tools
+
+ - name: Build | Build
+ if: matrix.target != 'x86_64-unknown-linux-musl'
+ run: cargo build --release --target ${{ matrix.target }}
+
+ - name: Build | Build (musl)
+ if: matrix.target == 'x86_64-unknown-linux-musl'
+ run: cargo build --release --target ${{ matrix.target }}
+
+ - name: Post Setup | Extract tag name
+ shell: bash
+ run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
+ id: extract_tag
+
+ - name: Post Setup | Prepare artifacts [Windows]
+ if: matrix.os == 'windows-latest'
+ run: |
+ mkdir target/stage
+ cd target/${{ matrix.target }}/release
+ strip ${{ env.CRATE_NAME }}.exe
+ 7z a ../../stage/${{ env.CRATE_NAME }}-${{ steps.extract_tag.outputs.tag }}-${{ matrix.target }} ${{ env.CRATE_NAME }}.exe
+ cd -
+
+ - name: Post Setup | Prepare artifacts [-nix]
+ if: matrix.os != 'windows-latest'
+ run: |
+ mkdir target/stage
+ cd target/${{ matrix.target }}/release
+ strip ${{ env.CRATE_NAME }}
+ tar czvf ../../stage/${{ env.CRATE_NAME }}-${{ steps.extract_tag.outputs.tag }}-${{ matrix.name }} ${{ env.CRATE_NAME }}
+ cd -
+
+ - name: Post Setup | Upload artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: ${{ env.CRATE_NAME }}-${{ steps.extract_tag.outputs.tag }}-${{ matrix.name }}
+ path: target/stage/*
+
+ # Create GitHub release with Rust build targets and release notes
+ github_release:
+ name: Create GitHub Release
+ needs: github_build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Setup | Artifacts
+ uses: actions/download-artifact@v2
+
+ - name: Setup | Release notes
+ run: |
+ git log -1 --pretty='%s' > RELEASE.md
+
+ - name: Build | Publish
+ uses: softprops/action-gh-release@v1
+ with:
+ files: ${{ env.CRATE_NAME }}-*/${{ env.CRATE_NAME }}-*
+ body_path: RELEASE.md
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..d512b94
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,53 @@
+name: Tests
+
+on: [push, pull_request]
+
+env:
+ RUSTFLAGS: -Dwarnings
+
+jobs:
+ build_and_test:
+ name: Build and test
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ rust: [stable]
+
+ steps:
+ - uses: actions/checkout@master
+
+ - name: Install ${{ matrix.rust }}
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+
+ - name: check
+ uses: actions-rs/cargo@v1
+ with:
+ command: check
+ args: --all
+
+ - name: tests
+ uses: actions-rs/cargo@v1
+ with:
+ command: test
+ args: --all
+
+ check_fmt_and_docs:
+ name: Checking fmt and docs
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@master
+ - uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ components: rustfmt, clippy
+ override: true
+
+ - name: fmt
+ run: cargo fmt --all -- --check
+
+ - name: Docs
+ run: cargo doc
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9fba9ea..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-# Based on the "trust" template v0.1.2
-# https://github.com/japaric/trust/tree/v0.1.2
-
-dist: trusty
-language: rust
-services: docker
-sudo: required
-
-env:
- global:
- - CRATE_NAME=mdbook-open-on-gh
-
-matrix:
- include:
- # Linux
- - env: TARGET=i686-unknown-linux-gnu
- - env: TARGET=x86_64-unknown-linux-gnu
-
- # OSX
- - env: TARGET=x86_64-apple-darwin
- os: osx
-
-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: "AoH64WLXrjR031qYfgTFGNBd2EU5n2yi7CXW+Zmd67AaYPvpK2CLV5XJyWg0uDHcgrdn9hf+W3K1VX/mH1cKSc3LOsRchmOZAkHKk4AUyIHREOVLgzLMJjLfr/4VpC8gtdrLknYExnxSPF+aUm1fhUHfr8RXeuXqTeHlkdGoROQZKO5tDcFGTZBtIxr3Wjr5+TPuHIeooSusHIf1c+ygHaC+kJPib+eW6fl39Eb7HeTO+7SjbL9kgq9ikFN/iDay8RXkMi9Rz3RavcnVytq8Mxz0JJlzNhS8uSwKNjxHxmOjVWkNE2hQ1t+jovWYjLceo7+KwNPkmVWcDCbcBcb1eoyVdawuKqnkrL9y8qtqhixgFWH0lpchhSBelHLAQSQWSLRD2Mbri99Bl9ug0KjH8cBIkXDN5upH6sMWuPw2n1sBGKsK/UhRT1ppcA9a3WGEq90fRo1ENkQNayv16tqZHjeKVRI8vDQLqdsGP51l9NL4KBGw5mKxk2v9Lew9YO4zt3thFFdJUwZmN7qjKX+Dul6kjMhqUZaKpLliRyf06OhjO+0u1t4WAYhLIy3Dz/FTw+1kOnkD10g3GqYEj8TKfUebb1AB3kCa//i/TjkycX8zxCK7pAM4uIwch+J/cKU8u1vqV7U0ZXL20x83i6TWkNEIWwXZ9cWuuX0IaF5z9l0="
- file_glob: true
- file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
- on:
- condition: $TRAVIS_RUST_VERSION = stable
- 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
- - /^\d+\.\d+\.\d+.*$/
- - master
-
-notifications:
- email: false
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index cecd4ea..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Based on the "trust" template v0.1.2
-# https://github.com/japaric/trust/tree/v0.1.2
-
-environment:
- global:
- RUST_VERSION: stable
-
- CRATE_NAME: mdbook-open-on-gh
-
- matrix:
- # MSVC
- - TARGET: i686-pc-windows-msvc
- - TARGET: x86_64-pc-windows-msvc
-
-install:
- - ps: >-
- If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
- $Env:PATH += ';C:\msys64\mingw64\bin'
- } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
- $Env:PATH += ';C:\msys64\mingw32\bin'
- }
- - 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
- - rustc -Vv
- - cargo -V
-
-test_script:
- # we don't run the "test phase" when doing deploys
- - if [%APPVEYOR_REPO_TAG%]==[false] (
- cargo test --target %TARGET% &&
- cargo build --target %TARGET%
- )
-
-before_deploy:
- - cargo rustc --target %TARGET% --release --bin mdbook-open-on-gh
- - ps: ci\before_deploy.ps1
-
-deploy:
- artifact: /.*\.zip/
- auth_token:
- secure: "kTwxCDJYj3QdFwxUiCEnUN8VcFAfU6KJKttab4G9LPCkpxVNexMvFTwWkp7sgamP"
- description: ''
- on:
- RUST_VERSION: stable
- appveyor_repo_tag: true
- provider: GitHub
-
-cache:
- - C:\Users\appveyor\.cargo\registry
- - target
-
-branches:
- only:
- # Release tags
- - /^\d+\.\d+\.\d+.*$/
- - master
-
-notifications:
- - provider: Email
- on_build_success: false
- on_build_failure: false
- on_build_status_changed: false
-
-# Building is done in the test phase, so we disable Appveyor's build phase.
-build: false
diff --git a/ci/before_deploy.ps1 b/ci/before_deploy.ps1
deleted file mode 100644
index c990f25..0000000
--- a/ci/before_deploy.ps1
+++ /dev/null
@@ -1,22 +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()
-
-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\target\$($Env:TARGET)\release\mdbook-open-on-gh.exe" '.\'
-
-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 5576c9b..0000000
--- a/ci/before_deploy.sh
+++ /dev/null
@@ -1,31 +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
-
- cross rustc --bin mdbook-open-on-gh --target $TARGET --release
-
- cp target/$TARGET/release/mdbook-open-on-gh $stage/
-
- 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 80e18e4..0000000
--- a/ci/install.sh
+++ /dev/null
@@ -1,47 +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
-
- # Builds for iOS are done on OSX, but require the specific target to be
- # installed.
- case $TARGET in
- aarch64-apple-ios)
- rustup target install aarch64-apple-ios
- ;;
- armv7-apple-ios)
- rustup target install armv7-apple-ios
- ;;
- armv7s-apple-ios)
- rustup target install armv7s-apple-ios
- ;;
- i386-apple-ios)
- rustup target install i386-apple-ios
- ;;
- x86_64-apple-ios)
- rustup target install x86_64-apple-ios
- ;;
- 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)
- 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 e61e155..0000000
--- a/ci/script.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# This script takes care of testing your crate
-
-set -ex
-
-main() {
- cross build --target $TARGET
-
- if [ ! -z $DISABLE_TESTS ]; then
- return
- fi
-
- cross test --target $TARGET
-}
-
-# we don't run the "test phase" when doing deploys
-if [ -z $TRAVIS_TAG ]; then
- main
-fi