mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Fix Rust/Swift caching and parallelize swift build (#1793)
- Renames remnants of `cloud` ref to `main` - Uses matrix for macOS, iphoneos builds
This commit is contained in:
3
.github/workflows/cd.yml
vendored
3
.github/workflows/cd.yml
vendored
@@ -2,8 +2,7 @@ name: Continuous Delivery
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- cloud
|
||||
- main
|
||||
|
||||
# Cancel old workflow runs if new code is pushed
|
||||
concurrency:
|
||||
|
||||
2
.github/workflows/elixir.yml
vendored
2
.github/workflows/elixir.yml
vendored
@@ -184,7 +184,7 @@ jobs:
|
||||
MIX_ENV: dev
|
||||
POSTGRES_HOST: localhost
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MASTER_BRANCH: cloud
|
||||
MASTER_BRANCH: main
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
|
||||
2
.github/workflows/kotlin.yml
vendored
2
.github/workflows/kotlin.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
commitish: cloud
|
||||
commitish: main
|
||||
id: release_drafter
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
4
.github/workflows/rust-pass-checks.yml
vendored
4
.github/workflows/rust-pass-checks.yml
vendored
@@ -33,10 +33,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
||||
rust_build-apple:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
||||
rust_cross-compile-relay: # cross is separate from test because cross-compiling yields different artifacts and we cannot reuse the cache.
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
4
.github/workflows/rust.yml
vendored
4
.github/workflows/rust.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
commitish: cloud
|
||||
commitish: main
|
||||
id: release_drafter
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
workspaces: ./rust
|
||||
key: v2
|
||||
prefix-key: rust-${{ matrix.runs-on }}
|
||||
save-if: ${{ github.ref == 'refs/heads/cloud' }}
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
|
||||
# TODO: Building *ring* from git requires us to install additional tools;
|
||||
# once we're not using a forked *ring* these 2 steps can be removed.
|
||||
|
||||
7
.github/workflows/swift-pass-checks.yml
vendored
7
.github/workflows/swift-pass-checks.yml
vendored
@@ -18,6 +18,13 @@ jobs:
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
||||
swift_build:
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- sdk: macosx
|
||||
platform: macOS
|
||||
- sdk: iphoneos
|
||||
platform: iOS
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
||||
|
||||
34
.github/workflows/swift.yml
vendored
34
.github/workflows/swift.yml
vendored
@@ -23,12 +23,21 @@ jobs:
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
commitish: cloud
|
||||
commitish: main
|
||||
id: release_drafter
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
swift_build:
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- sdk: macosx
|
||||
platform: macOS
|
||||
destination: platform=macOS
|
||||
- sdk: iphoneos
|
||||
platform: iOS
|
||||
destination: generic/platform=iOS
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -43,27 +52,24 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: ./rust
|
||||
prefix-key: rust-${{ matrix.runs-on }}
|
||||
save-if: ${{ github.ref == 'refs/heads/cloud' }}
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Update toolchain
|
||||
run: rustup show
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: apple/.build
|
||||
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
|
||||
path: ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
|
||||
key: ${{ matrix.target.platform }}-spm-${{ hashFiles('**/Package.resolved') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-spm-
|
||||
${{ matrix.target.platform }}-spm-
|
||||
- name: Select Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
- name: Build app for macOS
|
||||
- name: Build app
|
||||
env:
|
||||
ONLY_ACTIVE_ARCH: no
|
||||
|
||||
working-directory: ./swift/apple
|
||||
run: |
|
||||
cp Firezone/xcconfig/Developer.xcconfig.ci-macOS Firezone/xcconfig/Developer.xcconfig
|
||||
xcodebuild archive -scheme Firezone -sdk macosx -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO
|
||||
- name: Build app for iOS
|
||||
working-directory: ./swift/apple
|
||||
run: |
|
||||
cp Firezone/xcconfig/Developer.xcconfig.ci-iOS Firezone/xcconfig/Developer.xcconfig
|
||||
xcodebuild archive -scheme Firezone -sdk iphoneos -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO
|
||||
cp Firezone/xcconfig/Developer.xcconfig.ci-${{ matrix.target.platform }} Firezone/xcconfig/Developer.xcconfig
|
||||
xcodebuild archive -configuration Release -scheme Firezone -sdk ${{ matrix.target.sdk }} -destination '${{ matrix.target.destination }}' CODE_SIGNING_ALLOWED=NO
|
||||
|
||||
@@ -26,6 +26,16 @@ export INCLUDE_PATH="${base_dir}/usr/include"
|
||||
export CFLAGS="-L ${LIBRARY_PATH} -I ${INCLUDE_PATH} -Qunused-arguments"
|
||||
export RUSTFLAGS="-C link-arg=-F$base_dir/System/Library/Frameworks"
|
||||
|
||||
# Borrowed from https://github.com/signalapp/libsignal/commit/02899cac643a14b2ced7c058cc15a836a2165b6d
|
||||
# Thanks to @francesca64 for the fix
|
||||
if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then
|
||||
# Assume we're in Xcode, which means we're probably cross-compiling.
|
||||
# In this case, we need to add an extra library search path for build scripts and proc-macros,
|
||||
# which run on the host instead of the target.
|
||||
# (macOS Big Sur does not have linkable libraries in /usr/lib/.)
|
||||
export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}"
|
||||
fi
|
||||
|
||||
TARGETS=()
|
||||
if [[ "$PLATFORM_NAME" = "macosx" ]]; then
|
||||
if [[ $CONFIGURATION == "Release" ]] || [[ -z "$NATIVE_ARCH" ]]; then
|
||||
@@ -89,6 +99,6 @@ fi
|
||||
for target in "${TARGETS[@]}"
|
||||
do
|
||||
set -x
|
||||
cargo build --target $target $FEATURE_ARGS $CONFIGURATION_ARGS
|
||||
cargo build --target=$target $FEATURE_ARGS $CONFIGURATION_ARGS
|
||||
set +x
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user