ci: ⚡️ Improve release.yml and add aarch64-unknown-linux-gnu
This commit is contained in:
parent
eef158c308
commit
abec7e4c6f
53
.github/workflows/package.yml
vendored
53
.github/workflows/package.yml
vendored
@ -1,53 +0,0 @@
|
|||||||
name: Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
runs_on:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
target:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
extension:
|
|
||||||
default: ""
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build static binaries
|
|
||||||
runs-on: ${{ inputs.runs_on }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Change apt mirror and install dependencies
|
|
||||||
if: ${{ inputs.runs_on == 'ubuntu-latest' }}
|
|
||||||
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@v2
|
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
target: ${{ inputs.target }}
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v1
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
args: --release --all --target ${{ inputs.target }}
|
|
||||||
|
|
||||||
- uses: papeloto/action-zip@v1
|
|
||||||
with:
|
|
||||||
files: target/${{ inputs.target }}/release/web-flash${{ inputs.extension }}
|
|
||||||
recursive: true
|
|
||||||
dest: web-flash-${{ inputs.target }}.zip
|
|
||||||
|
|
||||||
- uses: svenstaro/upload-release-action@v2
|
|
||||||
with:
|
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
file: web-flash-${{ inputs.target }}.zip
|
|
||||||
tag: ${{ github.ref }}
|
|
104
.github/workflows/release.yml
vendored
104
.github/workflows/release.yml
vendored
@ -4,47 +4,81 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Linux
|
build:
|
||||||
|
name: Generating artifacts for ${{ matrix.job.target }}
|
||||||
|
runs-on: ${{ matrix.job.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
job:
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
extension: .exe
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-gnu
|
||||||
|
extension: .exe
|
||||||
|
- os: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
|
||||||
x86_64-unknown-linux-gnu:
|
steps:
|
||||||
uses: ./.github/workflows/package.yml
|
- name: Checkout repository
|
||||||
with:
|
uses: actions/checkout@v3
|
||||||
runs_on: ubuntu-latest
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
x86_64-unknown-linux-musl:
|
- name: Install Rust toolchain
|
||||||
uses: ./.github/workflows/package.yml
|
uses: dtolnay/rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
runs_on: ubuntu-latest
|
toolchain: stable
|
||||||
target: x86_64-unknown-linux-musl
|
targets: ${{ matrix.job.target }}
|
||||||
|
|
||||||
# macOS
|
- name: Install dependencies
|
||||||
|
if: matrix.job.os == 'ubuntu-20.04'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libudev-dev librust-libudev-sys-dev pkg-config
|
||||||
|
|
||||||
aarch64-apple-darwin:
|
- name: Setup cross compile env
|
||||||
uses: ./.github/workflows/package.yml
|
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
|
||||||
with:
|
run: |
|
||||||
runs_on: macos-latest
|
sudo sed -i 's/azure\.//' /etc/apt/sources.list
|
||||||
target: aarch64-apple-darwin
|
sudo apt-get update
|
||||||
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
sudo apt update
|
||||||
|
sudo dpkg --add-architecture arm64
|
||||||
|
sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:arm64" "libgcc-s1:arm64" "libc6:arm64" "libudev-dev:arm64" 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
|
||||||
|
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
|
||||||
|
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||||
|
|
||||||
x86_64-apple-darwin:
|
- name: Build project
|
||||||
uses: ./.github/workflows/package.yml
|
run: cargo build --release --all --target ${{ matrix.job.target }}
|
||||||
with:
|
|
||||||
runs_on: macos-latest
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
|
|
||||||
# Windows
|
- name: Compress (Unix)
|
||||||
|
if: ${{ matrix.job.os != 'windows-latest' }}
|
||||||
|
run: zip -j web-flash-${{ matrix.job.target }}.zip target/${{ matrix.job.target }}/release/web-flash
|
||||||
|
|
||||||
x86_64-pc-windows-gnu:
|
- name: Compress (Windows)
|
||||||
uses: ./.github/workflows/package.yml
|
if: ${{ matrix.job.os == 'windows-latest' }}
|
||||||
with:
|
run: Compress-Archive target/${{ matrix.job.target }}/release/web-flash${{ matrix.job.extension }} web-flash-${{ matrix.job.target }}.zip
|
||||||
runs_on: windows-latest
|
|
||||||
target: x86_64-pc-windows-gnu
|
|
||||||
extension: .exe
|
|
||||||
|
|
||||||
x86_64-pc-windows-msvc:
|
- name: Upload archives
|
||||||
uses: ./.github/workflows/package.yml
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
runs_on: windows-latest
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
target: x86_64-pc-windows-msvc
|
file: web-flash-${{ matrix.job.target }}.zip
|
||||||
extension: .exe
|
tag: ${{ github.ref }}
|
||||||
|
Loading…
Reference in New Issue
Block a user