name: ci
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
fail-fast:
${{ github.event_name == 'pull_request' || (github.ref !=
'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')) }}
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Install rust
uses: hecrj/setup-rust-action@v1
- name: Install clippy and rustfmt
run: |
rustup component add clippy
rustup component add rustfmt
- name: Log versions
run: |
rustc --version
cargo --version
- name: Configure cargo data directory
run: |
echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- name: Run cargo fmt
run: cargo fmt -- --check
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo test
run: cargo test
- name: Run cargo test with feature https
run: cargo test --features "https"
- name: Build release
run: cargo build --release
- name: Build release with feature https
run: cargo build --release --features "https"
- name: Publish
if: |
startsWith(matrix.os, 'ubuntu') &&
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish