Skip to content

Commit

Permalink
Build changes for 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-4 committed Aug 23, 2024
1 parent d5db313 commit 0667fce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/basic_webserver_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
env:
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.br
BASIC_WEBSERVER_BRANCH: main
RELEASE_TAG: 0.8.0

jobs:
fetch-releases:
Expand Down Expand Up @@ -46,16 +46,16 @@ jobs:
- name: build basic-webserver with legacy linker
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: ./ci/build_basic_webserver.sh linux_x86_64 "--linker legacy"
run: ./ci/build_basic_webserver.sh linux_x86_64

- name: Save .rh, .rm and .o file
- name: Save .rh, .rm and .a file
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-files
path: |
basic-webserver/platform/metadata_linux-x64.rm
basic-webserver/platform/linux-x64.rh
basic-webserver/platform/linux-x64.o
basic-webserver/platform/linux-x64.a
build-linux-arm64-files:
Expand All @@ -75,12 +75,12 @@ jobs:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
run: ./ci/build_basic_webserver.sh linux_arm64

- name: Save .o file
- name: Save .a file
uses: actions/upload-artifact@v4
with:
name: linux-arm64-files
path: |
basic-webserver/platform/linux-arm64.o
basic-webserver/platform/linux-arm64.a
build-macos-x86_64-files:
runs-on: [macos-12] # I expect the generated files to work on macOS 12 and up
Expand All @@ -93,15 +93,15 @@ jobs:

- run: ./ci/build_basic_webserver.sh macos_x86_64

- name: Save .o files
- name: Save .a files
uses: actions/upload-artifact@v4
with:
name: macos-x86_64-files
path: |
basic-webserver/platform/macos-x64.o
basic-webserver/platform/macos-x64.a
build-macos-apple-silicon-files:
name: build apple silicon .o file
name: build apple silicon .a file
runs-on: [self-hosted, macOS, ARM64]
needs: [fetch-releases]
steps:
Expand All @@ -112,12 +112,12 @@ jobs:

- run: ./ci/build_basic_webserver.sh macos_apple_silicon

- name: Save macos-arm64.o file
- name: Save macos-arm64.a file
uses: actions/upload-artifact@v4
with:
name: macos-apple-silicon-files
path: |
basic-webserver/platform/macos-arm64.o
basic-webserver/platform/macos-arm64.a
create-release-archive:
needs: [build-linux-x86_64-files, build-linux-arm64-files, build-macos-x86_64-files, build-macos-apple-silicon-files]
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
- run: |
git clone https://github.com/roc-lang/basic-webserver.git
cd basic-webserver
git checkout ${{ env.BASIC_WEBSERVER_BRANCH }}
git checkout ${{ env.RELEASE_TAG }}
cd ..
- run: cp macos-apple-silicon-files/* ./basic-webserver/platform
Expand Down
20 changes: 8 additions & 12 deletions ci/build_basic_webserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
set -euxo pipefail

git clone https://github.com/roc-lang/basic-webserver.git
cd basic-webserver
git checkout $RELEASE_TAG
cd ..

OS=$(uname -s)
ARCH=$(uname -m)
Expand Down Expand Up @@ -37,20 +40,13 @@ rm roc_nightly.tar.gz
# simplify dir name
mv roc_nightly* roc_nightly

# add roc to PATH
cd roc_nightly
export PATH="$(pwd -P):$PATH"
cd ..

# prevent https://github.com/roc-lang/basic-webserver/issues/9
if [ "$OS" != "Linux" ] || [ "$ARCH" != "x86_64" ]; then
# build the basic-webserver platform
./roc build ../basic-webserver/examples/echo.roc --optimize
fi

# We need this extra variable so we can safely check if $2 is empty later
EXTRA_ARGS=${2:-}
cd basic-webserver

# In some rare cases it's nice to be able to use the legacy linker, so we produce the .o file to be able to do that
if [ -n "${EXTRA_ARGS}" ];
then ./roc build $EXTRA_ARGS ../basic-webserver/examples/echo.roc --optimize
fi
roc build.roc --prebuilt-platform

cd ..

0 comments on commit 0667fce

Please sign in to comment.