Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit b3d60d3

Browse files
committed
Setup GitHub Actions
1 parent 07a8199 commit b3d60d3

File tree

3 files changed

+85
-14
lines changed

3 files changed

+85
-14
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
build_and_test:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
toolchain:
16+
- x86_64-unknown-linux-gnu
17+
- x86_64-apple-darwin
18+
- x86_64-pc-windows-msvc
19+
include:
20+
- toolchain: x86_64-unknown-linux-gnu
21+
builder: ubuntu-latest
22+
os: linux
23+
- toolchain: x86_64-apple-darwin
24+
builder: macos-latest
25+
os: macos
26+
- toolchain: x86_64-pc-windows-msvc
27+
builder: windows-latest
28+
os: windows
29+
30+
name: nightly - ${{ matrix.toolchain }}
31+
runs-on: ${{ matrix.builder }}
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
36+
- name: Run tests
37+
run: sh ci/run.sh ${{ matrix.os }}

.github/workflows/style.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Style check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
style_check:
12+
strategy:
13+
fail-fast: false
14+
15+
name: Shellcheck
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Run tests
22+
run: |
23+
shellcheck --version
24+
shellcheck ci/*.sh
25+
26+
- name: Update nightly
27+
run: |
28+
rustup update nightly
29+
30+
- name: rustfmt
31+
run: |
32+
if rustup component add rustfmt; then
33+
cargo fmt --all -- --check
34+
fi
35+
36+
- name: Clippy
37+
run: |
38+
if rustup component add clippy rustc-dev; then
39+
cargo clippy --all
40+
fi

ci/run.sh

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
set -ex
44

5+
OS=${1}
6+
57
export RUST_BACKTRACE=full
68
#export RUST_TEST_NOCAPTURE=1
79

10+
rustup update nightly
11+
812
cargo +nightly install rustup-toolchain-install-master
9-
if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
13+
if [ "${OS}" = "windows" ]; then
1014
rustup-toolchain-install-master -f -n master -c rustc-dev -c llvm-tools -i x86_64-pc-windows-msvc
1115
else
1216
rustup-toolchain-install-master -f -n master -c rustc-dev -c llvm-tools
@@ -16,12 +20,7 @@ rustup override set master
1620
cargo build
1721
cargo test --verbose -- --nocapture
1822

19-
# avoid weird cygwin issues for now
20-
if [ -n "$APPVEYOR" ]; then
21-
exit 0
22-
fi
23-
24-
case "${TRAVIS_OS_NAME}" in
23+
case "${OS}" in
2524
*"linux"*)
2625
TEST_TARGET=x86_64-unknown-linux-gnu cargo test --verbose -- --nocapture
2726
;;
@@ -33,11 +32,6 @@ case "${TRAVIS_OS_NAME}" in
3332
;;
3433
esac
3534

36-
# FIXME: Sometimes we couldn't install semverver on Travis' Windows builder.
37-
if [ "${TRAVIS_OS_NAME}" != "linux" ]; then
38-
exit 0
39-
fi
40-
4135
# install
4236
mkdir -p ~/rust/cargo/bin
4337
cp target/debug/cargo-semver ~/rust/cargo/bin
@@ -46,7 +40,7 @@ cp target/debug/rust-semverver ~/rust/cargo/bin
4640
# become semververver
4741
#
4842
# Note: Because we rely on rust nightly building the previously published
49-
# semver can often fail. To avoid failing the build we first check
43+
# semver can often fail. To avoid failing the build we first check
5044
# if we can compile the previously published version.
5145
if cargo install --root "$(mktemp -d)" semverver > /dev/null 2>/dev/null; then
5246
PATH=~/rust/cargo/bin:$PATH cargo semver | tee semver_out
@@ -64,5 +58,5 @@ if cargo install --root "$(mktemp -d)" semverver > /dev/null 2>/dev/null; then
6458
exit 1
6559
fi
6660
else
67-
echo 'Failed to check semver-compliance of semverver. Failed to compiled previous version.' >&2
61+
echo 'Failed to check semver-compliance of semverver. Failed to compiled previous version.' >&2
6862
fi

0 commit comments

Comments
 (0)