diff --git a/.github/actions/setup-arm/action.yml b/.github/actions/setup-target/action.yml similarity index 80% rename from .github/actions/setup-arm/action.yml rename to .github/actions/setup-target/action.yml index f3ff7cb1..5b2a5f94 100644 --- a/.github/actions/setup-arm/action.yml +++ b/.github/actions/setup-target/action.yml @@ -1,5 +1,5 @@ -name: Setup ARM Build Environment -description: Setup an ARM build environment +name: Setup target Build Environment +description: Setup an ARM or x86_64 build environment inputs: arch: @@ -16,6 +16,7 @@ runs: using: composite steps: - name: Replace target string + if: inputs.arch != 'x86_64' uses: mad9000/actions-find-and-replace-string@3 id: findandreplace with: @@ -33,11 +34,13 @@ runs: - uses: Swatinem/rust-cache@v2 - name: Install Cross-Compile Support + if: inputs.arch != 'x86_64' uses: cyberjunk/gha-ubuntu-cross@v3 with: arch: ${{ inputs.arch }} - - name: Install dependencies + - name: Install dependencies (Raspberry Pi) + if: inputs.arch != 'x86_64' shell: bash run: | sudo apt install -y \ @@ -53,7 +56,13 @@ runs: musl-tools \ pkg-config + - name: Install dependencies (x86_64 linux) + if: inputs.target == 'x86_64-unknown-linux-gnu' || inputs.target == 'x86_64-unknown-linux-musl' + shell: bash + run: sudo apt-get install musl-tools libudev-dev + - name: Set environment variables + if: inputs.arch != 'x86_64' shell: bash run: | echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd2cb0dc..cdf2158f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,99 +23,155 @@ jobs: # Check check: - name: Check + name: Check (${{ matrix.platform.target }}) strategy: fail-fast: false matrix: platform: - os: "macos-12" target: "x86_64-apple-darwin" + arch: "x86_64" - os: "ubuntu-22.04" target: "x86_64-unknown-linux-gnu" + arch: "x86_64" - os: "ubuntu-22.04" target: "x86_64-unknown-linux-musl" + arch: "x86_64" - os: "windows-2022" target: "x86_64-pc-windows-msvc" + arch: "x86_64" + - os: "ubuntu-22.04" + target: "aarch64-unknown-linux-gnu" + arch: "arm64" + features: "--features=raspberry" + - os: "ubuntu-22.04" + target: "armv7-unknown-linux-gnueabihf" + arch: "armhf" + features: "--features=raspberry" runs-on: ${{ matrix.platform.os }} steps: - - name: Install dependencies - if: matrix.platform.os == 'ubuntu-22.04' - run: sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable + + - uses: ./.github/actions/setup-target with: - targets: ${{ matrix.platform.target }} - - uses: Swatinem/rust-cache@v2 + arch: ${{ matrix.platform.arch }} + target: ${{ matrix.platform.target }} + + - run: cargo check ${{ matrix.platform.features }} - - run: cargo check check-lib: - name: Check (lib) + name: Check lib (${{ matrix.platform.target }}) + strategy: + fail-fast: false + matrix: + platform: + - target: "x86_64-unknown-linux-gnu" + arch: "x86_64" + - target: "aarch64-unknown-linux-gnu" + arch: "arm64" + features: "--features=raspberry" + - target: "armv7-unknown-linux-gnueabihf" + arch: "armhf" + features: "--features=raspberry" 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 + - uses: ./.github/actions/setup-target + with: + arch: ${{ matrix.platform.arch }} + target: ${{ matrix.platform.target }} + + - run: cargo check --lib --no-default-features ${{ matrix.platform.features }} msrv: - name: Check MSRV + name: Check MSRV (${{ matrix.platform.target }}) + strategy: + fail-fast: false + matrix: + platform: + - target: "x86_64-unknown-linux-gnu" + arch: "x86_64" + - target: "aarch64-unknown-linux-gnu" + arch: "arm64" + features: "--features=raspberry" + - target: "armv7-unknown-linux-gnueabihf" + arch: "armhf" + features: "--features=raspberry" 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 + + - uses: ./.github/actions/setup-target with: + arch: ${{ matrix.platform.arch }} + target: ${{ matrix.platform.target }} toolchain: "1.65" - - uses: Swatinem/rust-cache@v2 - - run: cargo check + - run: cargo check ${{ matrix.platform.features }} # -------------------------------------------------------------------------- # Test test: - name: Unit Tests + name: Unit Tests (${{ matrix.platform.target }}) + strategy: + fail-fast: false + matrix: + platform: + - target: "x86_64-unknown-linux-gnu" + arch: "x86_64" + - target: "aarch64-unknown-linux-gnu" + arch: "arm64" + features: "--features=raspberry" + - target: "armv7-unknown-linux-gnueabihf" + arch: "armhf" + features: "--features=raspberry" 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 + - uses: ./.github/actions/setup-target + with: + arch: ${{ matrix.platform.arch }} + target: ${{ matrix.platform.target }} + + - run: cargo test --lib ${{ matrix.platform.features }} # -------------------------------------------------------------------------- # Lint clippy: - name: Clippy + name: Clippy (${{ matrix.platform.target }}) + strategy: + fail-fast: false + matrix: + platform: + - target: "x86_64-unknown-linux-gnu" + arch: "x86_64" + - target: "aarch64-unknown-linux-gnu" + arch: "arm64" + features: "--features=raspberry" + - target: "armv7-unknown-linux-gnueabihf" + arch: "armhf" + features: "--features=raspberry" 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: ./.github/actions/setup-target with: + arch: ${{ matrix.platform.arch }} + target: ${{ matrix.platform.target }} components: clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy -- -D warnings -A clippy::too_many_arguments + - run: cargo clippy ${{ matrix.platform.features }} -- -D warnings -A clippy::too_many_arguments rustfmt: name: Rustfmt diff --git a/.github/workflows/raspberry_ci.yml b/.github/workflows/raspberry_ci.yml deleted file mode 100644 index 6bc1031f..00000000 --- a/.github/workflows/raspberry_ci.yml +++ /dev/null @@ -1,141 +0,0 @@ -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 diff --git a/Cargo.lock b/Cargo.lock index c515ab92..593ca6ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "cargo-espflash" -version = "2.0.0" +version = "2.0.1-dev" dependencies = [ "cargo", "cargo_metadata", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "espflash" -version = "2.0.0" +version = "2.0.1-dev" dependencies = [ "addr2line 0.20.0", "base64",