-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplified version of https://raw.githubusercontent.com/printfn/fend/d6cfe4da146ca7cc654cfed77e55b6e48f040129/.github/workflows/actions.yml thanks to https://raw.githubusercontent.com/jkroepke/openvpn-auth-oauth2/177c4600d6501978646289daabbcbe475bed40b5/.github/workflows/ci.yaml for showing how to add multiarch repos
- Loading branch information
Showing
1 changed file
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: [workflow-release-test] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_MIN_STACK: 16777212 | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
include: | ||
- platform: ubuntu-latest | ||
artifact-path: target/release/sdl | ||
artifact-platform-name: linux-x64 | ||
env-command: ">> $GITHUB_ENV" | ||
- platform: macos-latest | ||
artifact-path: target/release/sdl | ||
artifact-platform-name: macos-x64 | ||
env-command: ">> $GITHUB_ENV" | ||
- platform: windows-latest | ||
artifact-path: target/release/sdl.exe | ||
artifact-platform-name: windows-x64 | ||
env-command: "| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append" | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
timeout-minutes: 60 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Update Rust | ||
run: rustup update | ||
|
||
- uses: swatinem/rust-cache@v2 | ||
|
||
- name: Install multiarch dependencies (linux-armhf, linux-arm64) | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
run: | | ||
sudo dpkg --add-architecture armhf | ||
sudo dpkg --add-architecture arm64 | ||
sudo sed -i'' -E 's/^(deb|deb-src) /\1 [arch=amd64,i386] /' /etc/apt/sources.list | ||
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted universe" | sudo tee /etc/apt/sources.list.d/armhf.list | ||
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted universe" | sudo tee -a /etc/apt/sources.list.d/armhf.list | ||
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted universe" | sudo tee /etc/apt/sources.list.d/arm64.list | ||
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted universe" | sudo tee -a /etc/apt/sources.list.d/arm64.list | ||
sudo apt-get update -y | ||
sudo apt-get install -yq libssl-dev:armhf libssl-dev:armhf libssl-dev:arm64 | ||
- name: Build, get version | ||
run: | | ||
cargo run --release --bin sdl -- --help | ||
echo "SDL_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages | .[0].version')" ${{ matrix.env-command }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sdl-${{ env.SDL_VERSION }}-${{ matrix.artifact-platform-name }} | ||
path: ${{ matrix.artifact-path }} | ||
if-no-files-found: error | ||
|
||
- name: Build (macos-aarch64) | ||
if: ${{ matrix.platform == 'macos-latest' }} | ||
run: | | ||
rustup target add aarch64-apple-darwin | ||
cargo build --release --bin sdl --target aarch64-apple-darwin | ||
- name: Upload artifacts (macos-aarch64) | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ matrix.platform == 'macos-latest' }} | ||
with: | ||
name: sdl-${{ env.SDL_VERSION }}-macos-aarch64 | ||
path: target/aarch64-apple-darwin/release/sdl | ||
if-no-files-found: error | ||
|
||
- name: Build (linux-armv7-gnueabihf) | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
run: | | ||
rustup target add armv7-unknown-linux-gnueabihf | ||
sudo apt-get install -yq gcc-arm-linux-gnueabihf | ||
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc | ||
export ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR=/usr/lib/arm-linux-gnueabihf | ||
export ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR=/usr/include/arm-linux-gnueabihf | ||
cargo build --release --bin sdl --target armv7-unknown-linux-gnueabihf | ||
- name: Upload artifacts (linux-armv7-gnueabihf) | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
with: | ||
name: sdl-${{ env.SDL_VERSION }}-linux-armv7-gnueabihf | ||
path: target/armv7-unknown-linux-gnueabihf/release/sdl | ||
if-no-files-found: error | ||
|
||
- name: Build (linux-aarch64-gnu) | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
run: | | ||
rustup target add aarch64-unknown-linux-gnu | ||
sudo apt-get install -yq gcc-aarch64-linux-gnu | ||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc | ||
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu | ||
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu | ||
cargo build --release --bin sdl --target aarch64-unknown-linux-gnu | ||
- name: Upload artifacts (linux-aarch64-gnu) | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
with: | ||
name: sdl-${{ env.SDL_VERSION }}-linux-aarch64-gnu | ||
path: target/aarch64-unknown-linux-gnu/release/sdl | ||
if-no-files-found: error | ||
|
||
- name: Build (linux-x86_64-musl) | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
run: | | ||
rustup target add x86_64-unknown-linux-musl | ||
sudo apt-get install -yq musl-tools | ||
cargo build --release --bin sdl --target x86_64-unknown-linux-musl | ||
- name: Upload artifacts (linux-x86_64-musl) | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ matrix.platform == 'ubuntu-latest' }} | ||
with: | ||
name: sdl-${{ env.SDL_VERSION }}-linux-x64-musl | ||
path: target/x86_64-unknown-linux-musl/release/sdl | ||
if-no-files-found: error |