Skip to content

Commit 4ce9e20

Browse files
authored
Switch to github actions (#2)
1 parent d27fc69 commit 4ce9e20

File tree

8 files changed

+78
-257
lines changed

8 files changed

+78
-257
lines changed

.github/workflows/rust.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ v* ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest]
15+
rustv: [stable, beta, nightly]
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Install rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: ${{ matrix.rustv }}
23+
override: true
24+
- name: Run cargo check
25+
uses: actions-rs/cargo@v1
26+
with:
27+
command: check
28+
- name: Run cargo test
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: test
32+
args: --verbose
33+
34+
release:
35+
needs: test
36+
if: startsWith(github.ref, 'refs/tags/')
37+
strategy:
38+
matrix:
39+
runner:
40+
- os: ubuntu-16.04
41+
target: x86_64-unknown-linux-gnu
42+
- os: macos-10.15
43+
target: x86_64-apple-darwin
44+
runs-on: ${{ matrix.runner.os }}
45+
env:
46+
TARGET: ${{ matrix.runner.target }}
47+
PROJECT_NAME: git-fixup
48+
REF: ${{ github.ref }}
49+
steps:
50+
- uses: actions/checkout@v2
51+
- name: Install rust
52+
uses: actions-rs/toolchain@v1
53+
with:
54+
toolchain: stable
55+
target: ${{ matrix.runner.target }}
56+
override: true
57+
- name: Build Release
58+
run: ./ci/build-release-artifacts.sh
59+
- name: Upload Release
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
files: |
63+
deployment/*.tar.gz
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

ci/before_deploy.sh renamed to ci/build-release-artifacts.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# package the build artifacts
44

5-
set -ex
5+
set -xeuo pipefail
66

77
. "$(dirname "$0")/utils.sh"
88
. "$(dirname "$0")/deploy_utils.sh"
@@ -13,10 +13,9 @@ mk_artifacts() {
1313
}
1414

1515
main() {
16-
if [[ $TRAVIS_RUST_VERSION != stable ]]; then
17-
echo "Not building non-stable for deploy"
18-
return
19-
fi
16+
echo "env: $(env)" >&2
17+
export RELEASE
18+
RELEASE=$(basename "$REF")
2019
mk_artifacts
2120
mk_tarball
2221
}

ci/build.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

ci/build_musl.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

ci/deploy_utils.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ mk_temp() {
1212
}
1313

1414
mk_tarball() {
15-
# When cross-compiling, use the right `strip` tool on the binary.
16-
local gcc_prefix="$(gcc_prefix)"
15+
local tmpdir out_dir name staging
1716
# Create a temporary dir that contains our staging area.
1817
# $tmpdir/$name is what eventually ends up as the deployed archive.
19-
local tmpdir="$(mk_temp)"
20-
local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
21-
local staging="$tmpdir/$name"
18+
tmpdir="$(mk_temp)"
19+
name="${PROJECT_NAME}-${RELEASE}-${TARGET}"
20+
staging="$tmpdir/$name"
21+
2222
# The deployment directory is where the final archive will reside.
23-
# This path is known by the .travis.yml configuration.
24-
local out_dir="$(pwd)/deployment"
23+
# This path is known by the github actions configuration.
24+
out_dir="$(pwd)/deployment"
2525
mkdir -p "$staging" "$out_dir"
2626

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

3230
(cd "$tmpdir" && tar -czf "$out_dir/$name.tar.gz" "$name")
3331
rm -rf "$tmpdir"
32+
33+
ls "$out_dir/$name.tar.gz"
3434
}

ci/install.sh

Lines changed: 0 additions & 78 deletions
This file was deleted.

ci/utils.sh

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,9 @@ cargo_out_dir() {
1616
| xargs dirname
1717
}
1818

19-
host() {
20-
case "$TRAVIS_OS_NAME" in
21-
linux)
22-
echo x86_64-unknown-linux-gnu
23-
;;
24-
osx)
25-
echo x86_64-apple-darwin
26-
;;
27-
esac
28-
}
29-
30-
architecture() {
31-
case "$TARGET" in
32-
x86_64-*)
33-
echo amd64
34-
;;
35-
i686-*|i586-*|i386-*)
36-
echo i386
37-
;;
38-
arm*-unknown-linux-gnueabihf)
39-
echo armhf
40-
;;
41-
*)
42-
die "architecture: unexpected target $TARGET"
43-
;;
44-
esac
45-
}
46-
47-
gcc_prefix() {
48-
case "$(architecture)" in
49-
armhf)
50-
echo arm-linux-gnueabihf-
51-
;;
52-
*)
53-
return
54-
;;
55-
esac
56-
}
57-
58-
is_x86() {
59-
case "$(architecture)" in
60-
amd64|i386) return 0 ;;
61-
*) return 1 ;;
62-
esac
63-
}
64-
65-
is_linux() {
66-
case "$TRAVIS_OS_NAME" in
67-
linux) return 0 ;;
68-
*) return 1 ;;
69-
esac
70-
}
71-
7219
is_musl() {
7320
case "$TARGET" in
7421
*musl) return 0 ;;
7522
*) return 1 ;;
7623
esac
7724
}
78-
79-
is_osx() {
80-
case "$TRAVIS_OS_NAME" in
81-
osx) return 0 ;;
82-
*) return 1 ;;
83-
esac
84-
}

0 commit comments

Comments
 (0)