Skip to content

Commit

Permalink
crossed up
Browse files Browse the repository at this point in the history
  • Loading branch information
sadministrator committed Feb 1, 2024
1 parent 279b2a2 commit caf8470
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,48 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ubuntu-latest

steps:
- name: Set up Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
- name: Install Rust and Cross
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup component add rustfmt
cargo install cross
- name: Install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- name: Check out code
uses: actions/checkout@v2

- name: Build and package
run: cargo build --release

- name: Generate artifacts
- name: Build artifacts for Linux
run: |
if ($env:RUNNER_OS -eq "Windows") {
cargo build --release --target x86_64-pc-windows-gnu
zip -r earendil-windows.zip target/x86_64-pc-windows-gnu/release/earendil.exe
}
elseif ($env:RUNNER_OS -eq "macOS") {
cargo build --release --target x86_64-apple-darwin
mkdir -p earendil.app/Contents/MacOS
cp target/x86_64-apple-darwin/release/earendil earendil.app/Contents/MacOS/earendil
zip -r earendil-macos.zip earendil.app
}
else {
sudo apt-get update
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo build --release --target x86_64-unknown-linux-musl
zip -r earendil-linux.zip target/x86_64-unknown-linux-musl/release/earendil
}
- name: Upload artifacts
sudo apt-get update
sudo apt-get install musl-tools
rustup target add x86_64-unknown-linux-musl
cross build --target x86_64-unknown-linux-musl --release
env:
PKG_CONFIG_ALLOW_CROSS: 1

- name: Build artifacts for Windows
run: cross build --target x86_64-pc-windows-gnu --release
env:
PKG_CONFIG_ALLOW_CROSS: 1

- name: Build artifacts for Mac
run: cross build --target x86_64-apple-darwin --release
env:
PKG_CONFIG_ALLOW_CROSS: 1

- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: Earendil artifacts
name: artifacts
path: |
earendil-windows.zip
earendil-macos.zip
earendil-linux.zip
target/x86_64-pc-windows-gnu/release/
target/x86_64-apple-darwin/release/
target/x86_64-unknown-linux-musl/release/

0 comments on commit caf8470

Please sign in to comment.