Files
espflash/.github/workflows/rust.yml
Jesse Braham 2dc334f7dc Restore CI to working order (#121)
* Change apt mirror to official Ubuntu archives

* Fix a formatting issue causing the workflow to fail
2022-01-17 08:26:35 -08:00

193 lines
5.4 KiB
YAML

on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- name: build dependencies
run: |
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
test-doc:
name: Doc Test
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- name: build dependencies
run: |
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: test
args: --doc
test-lib:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- name: build dependencies
run: |
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: test
args: --lib
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- name: build dependencies
run: |
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
# `identity_op` and `or_fun_call` leads to false positives
args: -- -D warnings -A clippy::identity_op -A clippy::or_fun_call
build:
name: Build Static Binaries
runs-on: ubuntu-latest
steps:
- name: musl-tools
run: |
sudo apt-get install musl-tools
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --target x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v2
with:
name: espflash
path: target/x86_64-unknown-linux-musl/release/espflash
- uses: actions/upload-artifact@v2
with:
name: cargo-espflash
path: target/x86_64-unknown-linux-musl/release/cargo-espflash
build-windows:
name: Build Static Windows Binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --all --target x86_64-pc-windows-gnu
- uses: actions/upload-artifact@v2
with:
name: espflash.exe
path: target/x86_64-pc-windows-gnu/release/espflash.exe
- uses: actions/upload-artifact@v2
with:
name: cargo-espflash.exe
path: target/x86_64-pc-windows-gnu/release/cargo-espflash.exe
msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- name: build dependencies
run: |
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.56
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check