-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first attempt at binary distribution
- Loading branch information
1 parent
8ac089c
commit b65fbca
Showing
4 changed files
with
158 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,81 @@ | ||
name: package | ||
|
||
on: | ||
workflow_dispatch: | ||
# We build semver tags, and the master branch. | ||
push: | ||
branches: [ master ] | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
macos: | ||
runs-on: macos-15 | ||
name: macOS | ||
steps: | ||
- name: Setup AWS CLI | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-secret-access-key: ${{ secrets.AWS_S3_ACCESS_SECRET }} | ||
aws-access-key-id: ${{ vars.AWS_S3_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Archer | ||
run: | | ||
swift --version | ||
swift build -c release --product archer | ||
tar -czf archer.tar.gz -C .build/release archer | ||
- name: Upload products | ||
env: | ||
ARCHER_PLATFORM: "${{ runner.os }}-${{ runner.arch }}" | ||
ARCHER_VERSION: ${{ github.head_ref || github.ref_name }} | ||
|
||
run: Scripts/Deploy archer.tar.gz | ||
|
||
linux: | ||
strategy: | ||
matrix: | ||
os: | ||
- codename: jammy | ||
version: Ubuntu-22.04 | ||
display: Ubuntu 22.04 | ||
|
||
- codename: noble | ||
version: Ubuntu-24.04 | ||
display: Ubuntu 24.04 | ||
arch: | ||
- id: aarch64 | ||
name: ARM64 | ||
|
||
- id: x86_64 | ||
name: X64 | ||
|
||
runs-on: ubuntu-24.04 | ||
name: "${{ matrix.os.display }} (${{ matrix.arch.id }})" | ||
steps: | ||
- name: Setup AWS CLI | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-secret-access-key: ${{ secrets.AWS_S3_ACCESS_SECRET }} | ||
aws-access-key-id: ${{ vars.AWS_S3_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Archer | ||
run: | | ||
Scripts/BuildForBinaryDistribution ${{ matrix.arch.id }} \ | ||
--os ${{ matrix.os.codename }} \ | ||
tar -czf archer.tar.gz -C .build.${{ matrix.arch.id }} archer | ||
- name: Upload products | ||
env: | ||
ARCHER_PLATFORM: "${{ matrix.os.version }}-${{ matrix.arch.name }}" | ||
ARCHER_VERSION: ${{ github.head_ref || github.ref_name }} | ||
|
||
run: Scripts/Deploy archer.tar.gz |
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
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,54 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
SWIFT_VERSION=6.0.3 | ||
|
||
HOST_ARCH=$(uname -m) | ||
DEST_ARCH=aarch64 | ||
DEST_OS=noble | ||
LIBC=gnu | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--os ) | ||
shift | ||
|
||
case $1 in | ||
jammy | noble ) | ||
DEST_OS=$1 | ||
shift | ||
;; | ||
|
||
* ) | ||
echo "Unsupported OS '$1'" | ||
exit 1 | ||
;; | ||
esac | ||
;; | ||
|
||
x86_64 | aarch64) | ||
DEST_ARCH=$1 | ||
shift | ||
;; | ||
|
||
* ) | ||
echo "Unknown architecture '$1'" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# We actually have to clone the repo, as it contains symlinks that GitHub won’t follow with a | ||
# simple HTTP GET request. | ||
git -C swift-cross-aarch64 pull || git clone https://github.com/tayloraswift/swift-cross-aarch64 | ||
|
||
docker run --rm \ | ||
-v $PWD:/package \ | ||
-w /package \ | ||
tayloraswift/swift-cross-aarch64:${SWIFT_VERSION}-${DEST_OS} \ | ||
/home/ubuntu/$HOST_ARCH/swift/usr/bin/swift build \ | ||
--configuration release \ | ||
--scratch-path .build.$DEST_ARCH \ | ||
--cache-path /swiftpm \ | ||
--destination swift-cross-aarch64/Destinations/$HOST_ARCH/$DEST_ARCH-$DEST_OS.json \ | ||
--static-swift-stdlib |
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,20 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -z $ARCHER_PLATFORM ]; then | ||
echo "ARCHER_PLATFORM environment variable not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z $ARCHER_VERSION ]; then | ||
echo "ARCHER_VERSION environment variable not set" | ||
exit 1 | ||
fi | ||
|
||
while [[ $# -gt 0 ]]; do | ||
aws s3 cp $1 \ | ||
s3://swiftinit/archer/$ARCHER_VERSION/$ARCHER_PLATFORM/$1 \ | ||
--content-encoding gzip \ | ||
--content-type application/gzip | ||
shift | ||
done |