Skip to content

Commit

Permalink
Merge pull request #7 from SergioGasquez/feature/cd-aarch64
Browse files Browse the repository at this point in the history
Add `aarch64-unknown-linux-gnu` binary
  • Loading branch information
bjoernQ authored Feb 13, 2023
2 parents eef158c + 1869ed1 commit 3b512ff
Show file tree
Hide file tree
Showing 5 changed files with 284 additions and 119 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/package.yml

This file was deleted.

120 changes: 77 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,81 @@ on:
release:
types: [created]

env:
CARGO_TERM_COLOR: always

jobs:
# Linux

x86_64-unknown-linux-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
target: x86_64-unknown-linux-gnu

x86_64-unknown-linux-musl:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
target: x86_64-unknown-linux-musl

# macOS

aarch64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: aarch64-apple-darwin

x86_64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: x86_64-apple-darwin

# Windows

x86_64-pc-windows-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
target: x86_64-pc-windows-gnu
extension: .exe

x86_64-pc-windows-msvc:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
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

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.job.target }}

- 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
- name: Setup cross compile env
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
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
- name: Build project
run: cargo build --release --all --target ${{ matrix.job.target }}

- 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

- name: Compress (Windows)
if: ${{ matrix.job.os == 'windows-latest' }}
run: Compress-Archive target/${{ matrix.job.target }}/release/web-flash${{ matrix.job.extension }} web-flash-${{ matrix.job.target }}.zip

- name: Upload archives
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-flash-${{ matrix.job.target }}.zip
tag: ${{ github.ref }}
Loading

0 comments on commit 3b512ff

Please sign in to comment.