ci: 👷 Add CI

This commit is contained in:
Sergio Gasquez 2022-09-17 08:54:55 +02:00
parent b94747d126
commit 51d3b6ec24

55
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
---
name: Build check
on:
push:
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
- 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