mirror of
https://github.com/Xithrius/twitch-tui.git
synced 2024-10-26 14:13:42 +03:00
3c426e9316
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
123 lines
2.9 KiB
YAML
123 lines
2.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-test:
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
|
|
name: Build & Test (${{ matrix.target }})
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
RA_TARGET: ${{ matrix.target }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Install Rust library source
|
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
override: true
|
|
components: rust-src
|
|
|
|
- name: Build
|
|
run: cargo build --verbose --target ${{ matrix.target }}
|
|
|
|
- name: Run tests
|
|
run: cargo test --verbose --target ${{ matrix.target }}
|
|
|
|
lint:
|
|
name: Formatter
|
|
|
|
needs: build-test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
run: |
|
|
rustup update stable
|
|
rustup default stable
|
|
rustup component add rustfmt
|
|
rustup component add clippy
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Check code for possible improvements
|
|
run: cargo clippy -- -D warnings
|
|
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: llvm-tools
|
|
|
|
- name: Install cargo-llvm-cov
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-llvm-cov
|
|
|
|
- name: Generate coverage
|
|
run: cargo-llvm-cov llvm-cov --lcov --output-path "target/lcov.info" --all-features
|
|
|
|
- name: Upload to codecov.io
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
fail_ci_if_error: true
|
|
|
|
- name: Prepare Pull Request Payload artifact
|
|
id: prepare-artifact
|
|
if: always() && github.event_name == 'pull_request'
|
|
continue-on-error: true
|
|
run: cat $GITHUB_EVENT_PATH | jq '.pull_request' > pull_request_payload.json
|
|
|
|
- name: Upload a Build Artifact
|
|
if: always() && steps.prepare-artifact.outcome == 'success'
|
|
continue-on-error: true
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pull-request-payload
|
|
path: pull_request_payload.json
|