ci: ♻️ Refactor ci checks

This commit is contained in:
Sergio Gasquez 2022-09-26 08:33:10 +00:00
parent 3df1dbb9ea
commit e9dcc5e00c
2 changed files with 72 additions and 57 deletions

View File

@ -1,57 +0,0 @@
---
name: Build check
on:
push:
paths-ignore:
- "**/README.md"
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build-espup:
name: Build espup
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install libudev-dev
- name: Checkout repository
uses: actions/checkout@v3
- name: Update Rust toolchain
run: rustup update stable && rustup default stable
- name: Enable caching
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release
- name: Format check
run: cargo fmt -- --check
- name: Run tests
run: cargo test --verbose
- name: Clippy check
run: cargo clippy --no-deps -- -Dwarnings
- name: Archive artifact (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v2
with:
name: espup.exe
path: target/release/espup.exe
- name: Archive artifact (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v2
with:
name: espup-linux
path: target/release/espup
- name: Archive artifact (MacOs)
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v2
with:
name: espup-macos
path: target/release/espup

72
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,72 @@
---
name: Continuous Integration
on:
push:
paths-ignore:
- "**/README.md"
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
continuous-integration:
name: Build espup
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- os: macos-latest
binary-postfix: ""
- os: ubuntu-latest
binary-postfix: ""
- os: windows-latest
binary-postfix: ".exe"
steps:
- name: Install dependencies
if: ${{ matrix.job.os == 'ubuntu-latest' }}
run: |
sudo apt-get install libudev-dev
- name: Checkout repository
uses: actions/checkout@v3
- name: Update Rust toolchain
run: rustup update stable && rustup default stable
- name: Enable caching
uses: Swatinem/rust-cache@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Test suite
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --workspace
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features --workspace -- -D warnings
- name: Docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --document-private-items --all-features --workspace --examples
- name: Publish dry run
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run
- name: Archive artifact
uses: actions/upload-artifact@v2
with:
name: espup${{ matrix.job.binary-postfix }}
path: target/release/espup${{ matrix.job.binary-postfix }}