mirror of
https://github.com/esp-rs/espflash.git
synced 2026-03-19 05:45:12 +00:00
* ci: ⬆️ Bump actions/checkout * ci: ⬆️ Bump Swatinem/rust-cache * ci: ⚡️ Avoid using actions-rs * ci: ⚡️ Replace actions-rs/toolchain by dtolnay/rust-toolchain * ci: ⚡️ Fix CI warnings * ci: 🎨 Fix inputs * ci: ⚡️ Update mad9000/actions-find-and-replace-string and remove action-rs * ci: ⚡️ Update mad9000/actions-find-and-replace-string and remove action-rs
67 lines
2.8 KiB
YAML
67 lines
2.8 KiB
YAML
name: Rasberry Pi Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
target:
|
|
required: true
|
|
type: string
|
|
arch:
|
|
required: false
|
|
default: ""
|
|
type: string
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
publish-release:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
crate: ["espflash", "cargo-espflash"]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dtolnay/rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: ${{ inputs.target }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Replace target string
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: findandreplace
|
|
with:
|
|
source: ${{ inputs.target }}
|
|
find: "unknown-"
|
|
replace: ""
|
|
- name: Build dependencies
|
|
run: |
|
|
sudo sed -i 's/azure\.//' /etc/apt/sources.list
|
|
sudo apt-get update
|
|
echo "deb [arch=${{ inputs.arch }}] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list
|
|
echo "deb [arch=${{ inputs.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 ${{ inputs.arch }}
|
|
sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:${{ inputs.arch }}" "libgcc-s1:${{ inputs.arch }}" "libc6:${{ inputs.arch }}" "libudev-dev:${{ inputs.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 [[ ${{ 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
|
|
- run: cargo build --release --all --target ${{ inputs.target }} --features=raspberry
|
|
- name: Compress
|
|
run: zip -j ${{ matrix.crate }}-${{ inputs.target }}.zip target/${{ inputs.target }}/release/${{ matrix.crate }}${{ inputs.extension }}
|
|
- uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: ${{ matrix.crate }}-${{ inputs.target }}.zip
|
|
tag: ${{ github.ref }}
|