blob: f4f8de9e80c875a244a423b66ac7341c630888dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
name: Continuous Integration
on: [push, pull_request]
jobs:
# Run the `rustfmt` code formatter
rustfmt:
name: Rustfmt [Formatter]
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@master
- uses: actions/checkout@master
- name: Install rustfmt
run: rustup component add rustfmt
- name: Run rustfmt
run: cargo fmt --all -- --check
# Run the `clippy` linting tool
clippy:
name: Clippy [Linter]
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@master
- uses: actions/checkout@master
- name: Install clippy
run: rustup component add clippy
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D clippy::all
# Ensure that the project could be successfully compiled
cargo_check:
name: Compile
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@master
- uses: actions/checkout@master
- run: cargo check --all
# Run tests on Linux, and macOS
# On both Rust stable and Rust nightly
test:
name: Test Suite
needs: [rustfmt, clippy, cargo_check]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable, nightly]
steps:
# Install all the required dependencies for testing
- uses: hecrj/setup-rust-action@master
with:
rust-version: ${{ matrix.rust }}
# Install Node.js at a fixed version
- uses: actions/setup-node@master
with:
node-version: "12.0.0"
# Install Golang at a fixed version
- uses: actions/setup-go@master
with:
go-version: "1.12.1"
# Install Ruby at a fixed version
- uses: actions/setup-ruby@master
with:
ruby-version: "2.6.3"
# Install Python at a fixed version
- uses: actions/setup-python@master
with:
python-version: "3.6.9"
# Run the ignored tests that expect the above setup
- uses: actions/checkout@master
- name: Run all tests
run: cargo test -- -Z unstable-options --include-ignored
# Run the tests in the Docker image
docker_test:
name: Test in Docker
needs: [rustfmt, clippy, cargo_check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Pull the pre-built Docker image
run: docker pull starshipcommand/starship-test
- name: Fix file permissions
run: chmod -R a+w .
- name: Build the Docker image
run: docker build -f tests/Dockerfile --tag starshipcommand/starship-test --cache-from starshipcommand/starship-test .
- name: Run tests in Docker
run: docker run --rm -v $(pwd):/src/starship starshipcommand/starship-test
|