Skip to content

Commit

Permalink
Switch to github actions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
quodlibetor authored Apr 11, 2020
1 parent d27fc69 commit 4ce9e20
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 257 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Rust

on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
branches: [ master ]

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rustv: [stable, beta, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rustv }}
override: true
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose

release:
needs: test
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
runner:
- os: ubuntu-16.04
target: x86_64-unknown-linux-gnu
- os: macos-10.15
target: x86_64-apple-darwin
runs-on: ${{ matrix.runner.os }}
env:
TARGET: ${{ matrix.runner.target }}
PROJECT_NAME: git-fixup
REF: ${{ github.ref }}
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.runner.target }}
override: true
- name: Build Release
run: ./ci/build-release-artifacts.sh
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: |
deployment/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

9 changes: 4 additions & 5 deletions ci/before_deploy.sh → ci/build-release-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# package the build artifacts

set -ex
set -xeuo pipefail

. "$(dirname "$0")/utils.sh"
. "$(dirname "$0")/deploy_utils.sh"
Expand All @@ -13,10 +13,9 @@ mk_artifacts() {
}

main() {
if [[ $TRAVIS_RUST_VERSION != stable ]]; then
echo "Not building non-stable for deploy"
return
fi
echo "env: $(env)" >&2
export RELEASE
RELEASE=$(basename "$REF")
mk_artifacts
mk_tarball
}
Expand Down
20 changes: 0 additions & 20 deletions ci/build.sh

This file was deleted.

35 changes: 0 additions & 35 deletions ci/build_musl.sh

This file was deleted.

18 changes: 9 additions & 9 deletions ci/deploy_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ mk_temp() {
}

mk_tarball() {
# When cross-compiling, use the right `strip` tool on the binary.
local gcc_prefix="$(gcc_prefix)"
local tmpdir out_dir name staging
# Create a temporary dir that contains our staging area.
# $tmpdir/$name is what eventually ends up as the deployed archive.
local tmpdir="$(mk_temp)"
local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
local staging="$tmpdir/$name"
tmpdir="$(mk_temp)"
name="${PROJECT_NAME}-${RELEASE}-${TARGET}"
staging="$tmpdir/$name"

# The deployment directory is where the final archive will reside.
# This path is known by the .travis.yml configuration.
local out_dir="$(pwd)/deployment"
# This path is known by the github actions configuration.
out_dir="$(pwd)/deployment"
mkdir -p "$staging" "$out_dir"

# Copy the binary and strip it.
cp "target/$TARGET/release/git-fixup" "$staging/git-fixup"
# Copy the licenses and README.
cp README.md LICENSE-{MIT,APACHE} "$staging/"

(cd "$tmpdir" && tar -czf "$out_dir/$name.tar.gz" "$name")
rm -rf "$tmpdir"

ls "$out_dir/$name.tar.gz"
}
78 changes: 0 additions & 78 deletions ci/install.sh

This file was deleted.

60 changes: 0 additions & 60 deletions ci/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,9 @@ cargo_out_dir() {
| xargs dirname
}

host() {
case "$TRAVIS_OS_NAME" in
linux)
echo x86_64-unknown-linux-gnu
;;
osx)
echo x86_64-apple-darwin
;;
esac
}

architecture() {
case "$TARGET" in
x86_64-*)
echo amd64
;;
i686-*|i586-*|i386-*)
echo i386
;;
arm*-unknown-linux-gnueabihf)
echo armhf
;;
*)
die "architecture: unexpected target $TARGET"
;;
esac
}

gcc_prefix() {
case "$(architecture)" in
armhf)
echo arm-linux-gnueabihf-
;;
*)
return
;;
esac
}

is_x86() {
case "$(architecture)" in
amd64|i386) return 0 ;;
*) return 1 ;;
esac
}

is_linux() {
case "$TRAVIS_OS_NAME" in
linux) return 0 ;;
*) return 1 ;;
esac
}

is_musl() {
case "$TARGET" in
*musl) return 0 ;;
*) return 1 ;;
esac
}

is_osx() {
case "$TRAVIS_OS_NAME" in
osx) return 0 ;;
*) return 1 ;;
esac
}

0 comments on commit 4ce9e20

Please sign in to comment.