mirror of
https://github.com/esp-rs/espflash.git
synced 2026-03-13 17:37:49 +00:00
Update the CI workflow
This commit is contained in:
parent
092a637e98
commit
151ca29a09
70
.github/actions/setup-arm/action.yml
vendored
Normal file
70
.github/actions/setup-arm/action.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
name: Setup ARM Build Environment
|
||||
description: Setup an ARM build environment
|
||||
|
||||
inputs:
|
||||
arch:
|
||||
required: true
|
||||
target:
|
||||
required: true
|
||||
toolchain:
|
||||
default: stable
|
||||
required: false
|
||||
components:
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Replace target string
|
||||
uses: mad9000/actions-find-and-replace-string@3
|
||||
id: findandreplace
|
||||
with:
|
||||
source: ${{ inputs.target }}
|
||||
find: "unknown-"
|
||||
replace: ""
|
||||
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ inputs.toolchain }}
|
||||
target: ${{ inputs.target }}
|
||||
components: ${{ inputs.components }}
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Install Cross-Compile Support
|
||||
uses: cyberjunk/gha-ubuntu-cross@v3
|
||||
with:
|
||||
arch: ${{ inputs.arch }}
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt install -y \
|
||||
curl \
|
||||
gcc-aarch64-linux-gnu \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
git \
|
||||
"libc6:${{ inputs.arch }}" \
|
||||
"libgcc-s1:${{ inputs.arch }}" \
|
||||
libudev-dev \
|
||||
"libudev-dev:${{ inputs.arch }}" \
|
||||
"libudev1:${{ inputs.arch }}" \
|
||||
musl-tools \
|
||||
pkg-config
|
||||
|
||||
- name: Set environment variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
|
||||
if [[ ${{ inputs.arch }} == arm64 ]]; then
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/${{ steps.findandreplace.outputs.value }}/pkgconfig" >> $GITHUB_ENV
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${{ steps.findandreplace.outputs.value }}-gcc" >> $GITHUB_ENV
|
||||
fi
|
||||
if [[ ${{ inputs.arch }} == armhf ]]; then
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV
|
||||
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
|
||||
fi
|
||||
120
.github/workflows/ci.yml
vendored
Normal file
120
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
# Cancel any currently running workflows from the same PR, branch, or
|
||||
# tag when a new workflow is triggered.
|
||||
#
|
||||
# https://stackoverflow.com/a/66336834
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
|
||||
jobs:
|
||||
# --------------------------------------------------------------------------
|
||||
# Check
|
||||
|
||||
check:
|
||||
name: Check
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["macos-12", "ubuntu-22.04", "windows-2022"]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
run: sudo apt-get install musl-tools libudev-dev
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo check
|
||||
|
||||
check-lib:
|
||||
name: Check (lib)
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install musl-tools libudev-dev
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo check --lib --no-default-features
|
||||
|
||||
msrv:
|
||||
name: Check MSRV
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install musl-tools libudev-dev
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: "1.65"
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo check
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Test
|
||||
|
||||
test:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install musl-tools libudev-dev
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo test --lib
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Lint
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install musl-tools libudev-dev
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo clippy -- -D warnings -A clippy::too_many_arguments
|
||||
|
||||
rustfmt:
|
||||
name: Rustfmt
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- run: cargo fmt --all -- --check
|
||||
141
.github/workflows/raspberry_ci.yml
vendored
Normal file
141
.github/workflows/raspberry_ci.yml
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
name: Raspberry Pi CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
# Cancel any currently running workflows from the same PR, branch, or
|
||||
# tag when a new workflow is triggered.
|
||||
#
|
||||
# https://stackoverflow.com/a/66336834
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
|
||||
jobs:
|
||||
# --------------------------------------------------------------------------
|
||||
# Check
|
||||
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- arch: arm64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- arch: armhf
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-arm
|
||||
with:
|
||||
arch: ${{ matrix.board.arch }}
|
||||
target: ${{ matrix.board.target }}
|
||||
|
||||
- run: cargo check --features=raspberry
|
||||
|
||||
check-lib:
|
||||
name: Check (lib)
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- arch: arm64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- arch: armhf
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-arm
|
||||
with:
|
||||
arch: ${{ matrix.board.arch }}
|
||||
target: ${{ matrix.board.target }}
|
||||
|
||||
- run: cargo check --lib --no-default-features --features=raspberry
|
||||
|
||||
msrv:
|
||||
name: Check MSRV
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- arch: arm64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- arch: armhf
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-arm
|
||||
with:
|
||||
arch: ${{ matrix.board.arch }}
|
||||
target: ${{ matrix.board.target }}
|
||||
toolchain: "1.65"
|
||||
|
||||
- run: cargo check --features=raspberry
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Test
|
||||
|
||||
test:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- arch: arm64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- arch: armhf
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-arm
|
||||
with:
|
||||
arch: ${{ matrix.board.arch }}
|
||||
target: ${{ matrix.board.target }}
|
||||
|
||||
- run: cargo test --lib --features=raspberry
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Lint
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- arch: arm64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
- arch: armhf
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup-arm
|
||||
with:
|
||||
arch: ${{ matrix.board.arch }}
|
||||
target: ${{ matrix.board.target }}
|
||||
components: clippy
|
||||
|
||||
- run: cargo clippy --features=raspberry -- -D warnings -A clippy::too_many_arguments
|
||||
89
.github/workflows/raspberry_rust.yml
vendored
89
.github/workflows/raspberry_rust.yml
vendored
@ -1,89 +0,0 @@
|
||||
name: Rasberry Pi CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
rust-ci:
|
||||
name: "Rust CI: ${{ matrix.job.name }} - ${{ matrix.board.target }}"
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- target: armv7-unknown-linux-gnueabihf
|
||||
arch: armhf
|
||||
- target: aarch64-unknown-linux-gnu
|
||||
arch: arm64
|
||||
job:
|
||||
- name: Check
|
||||
toolchain: stable
|
||||
cargo-command: check
|
||||
args: --features=raspberry
|
||||
- name: Check (lib)
|
||||
toolchain: stable
|
||||
cargo-command: check
|
||||
args: --lib --no-default-features --features=raspberry
|
||||
- name: Check MSRV
|
||||
toolchain: "1.65"
|
||||
cargo-command: check
|
||||
args: --features=raspberry
|
||||
- name: Unit Test
|
||||
toolchain: stable
|
||||
cargo-command: test
|
||||
args: --lib --features=raspberry
|
||||
- name: Rustfmt
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
cargo-command: fmt
|
||||
args: --all -- --check
|
||||
- name: Clippy
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
cargo-command: clippy
|
||||
args: --features=raspberry -- -D warnings -A clippy::too_many_arguments
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.job.toolchain }}
|
||||
target: ${{ matrix.board.target }}
|
||||
components: ${{ matrix.job.components }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Replace target string
|
||||
uses: mad9000/actions-find-and-replace-string@3
|
||||
id: findandreplace
|
||||
with:
|
||||
source: ${{ matrix.board.target }}
|
||||
find: "unknown-"
|
||||
replace: ""
|
||||
- name: Build dependencies
|
||||
if: matrix.job.cargo-command != 'fmt'
|
||||
run: |
|
||||
sudo sed -i 's/azure\.//' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
echo "deb [arch=${{ matrix.board.arch }}] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list
|
||||
echo "deb [arch=${{ matrix.board.arch }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt update
|
||||
sudo dpkg --add-architecture ${{ matrix.board.arch }}
|
||||
sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:${{ matrix.board.arch }}" "libgcc-s1:${{ matrix.board.arch }}" "libc6:${{ matrix.board.arch }}" "libudev-dev:${{ matrix.board.arch }}" gcc-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu
|
||||
echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
|
||||
if [[ ${{ matrix.board.arch }} == arm64 ]]; then
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/${{ steps.findandreplace.outputs.value }}/pkgconfig" >> $GITHUB_ENV
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${{ steps.findandreplace.outputs.value }}-gcc" >> $GITHUB_ENV
|
||||
fi
|
||||
if [[ ${{ matrix.board.arch }} == armhf ]]; then
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV
|
||||
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
|
||||
fi
|
||||
- run: cargo ${{ matrix.job.cargo-command }} ${{ matrix.job.args }}
|
||||
106
.github/workflows/rust.yml
vendored
106
.github/workflows/rust.yml
vendored
@ -1,106 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Change apt mirror and install dependencies
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install musl-tools libudev-dev
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check
|
||||
|
||||
check-lib:
|
||||
name: Check (lib)
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Change apt mirror and install dependencies
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install musl-tools libudev-dev
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check --lib --no-default-features
|
||||
|
||||
msrv:
|
||||
name: Check MSRV
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Change apt mirror and install dependencies
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install musl-tools libudev-dev
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: "1.65"
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check
|
||||
|
||||
test-lib:
|
||||
name: Unit Test
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Change apt mirror and install dependencies
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install musl-tools libudev-dev
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo test --lib
|
||||
|
||||
fmt:
|
||||
name: Rustfmt
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Change apt mirror and install dependencies
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install musl-tools libudev-dev
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
# `too_many_arguments` is relatively arbitrary
|
||||
- run: cargo clippy -- -A clippy::too_many_arguments -D warnings
|
||||
@ -1,6 +1,6 @@
|
||||
# espflash
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user