2019-09-04 23:13:53 +00:00
|
|
|
name: Continuous Integration
|
2019-09-05 00:56:06 +00:00
|
|
|
on: [push, pull_request]
|
2019-09-04 23:13:53 +00:00
|
|
|
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
|