Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new webserver release script, basic-cli release script updates #6014

Merged
merged 30 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8b6bb9d
prep basic-cli 0.5 release
Anton-4 Aug 11, 2023
e266158
arm64 fixes
Anton-4 Aug 12, 2023
a9b9776
specify linux_x86_64
Anton-4 Aug 12, 2023
d5eca4a
x86_64 > x64
Anton-4 Aug 12, 2023
628f41a
build before final test
Anton-4 Aug 12, 2023
08f7865
fix path, back to main branch
Anton-4 Aug 12, 2023
4b53557
added debug upload
Anton-4 Aug 18, 2023
e11725b
add prebuilt-platform flag
Anton-4 Aug 21, 2023
6650f62
try with musl
Anton-4 Aug 22, 2023
63d2f8e
Merge branch 'main' into basic-cli-5-release
Anton-4 Sep 9, 2023
48d1429
Merge branch 'main' into basic-cli-5-release
Anton-4 Oct 6, 2023
e07a749
Merge branch 'main' into basic-cli-5-release
Anton-4 Nov 13, 2023
d9914bb
temp disable other workflows
Anton-4 Nov 13, 2023
3ada01d
sudo musl-tools fix
Anton-4 Nov 14, 2023
ad4b929
added flags required for ring (musl)
Anton-4 Nov 15, 2023
e5c584b
test with all examples
Anton-4 Nov 15, 2023
e6bf12f
fix if
Anton-4 Nov 15, 2023
51c7ba2
fix path issue
Anton-4 Nov 15, 2023
dc8d709
fix examples path
Anton-4 Nov 15, 2023
cb488ea
use prebuilt-platform flag
Anton-4 Nov 17, 2023
abd622b
Update basic_cli_build_release.yml
Anton-4 Nov 17, 2023
badc45d
ci install ncat(nmap)
Anton-4 Nov 17, 2023
04b620b
apparently nmap does not contain ncat
Anton-4 Nov 17, 2023
9217494
set up basic_webserver build
Anton-4 Nov 19, 2023
4cb9b24
chmod +x
Anton-4 Nov 19, 2023
ee74635
forgot cd
Anton-4 Nov 19, 2023
a9c9273
prevent undefined symbol
Anton-4 Nov 19, 2023
116aad2
get brotli started
Anton-4 Nov 19, 2023
71cb2ed
build with main branch
Anton-4 Nov 20, 2023
75e04a5
cleanup
Anton-4 Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 62 additions & 23 deletions .github/workflows/basic_cli_build_release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
on:
#pull_request:
# pull_request:
workflow_dispatch:

# this cancels workflows currently in progress if you start a new one
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# use .tar.gz for quick testing
env:
ARCHIVE_FORMAT: .tar.br
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.gz
BASIC_CLI_BRANCH: main

jobs:
fetch-releases:
Expand All @@ -18,6 +19,7 @@ jobs:
- uses: actions/checkout@v3

- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz

Expand Down Expand Up @@ -45,12 +47,37 @@ jobs:
with:
name: linux-x86_64-files
path: |
basic-cli/src/metadata_linux-x86_64.rm
basic-cli/src/linux-x86_64.rh
basic-cli/src/linux-x86_64.o
basic-cli/src/metadata_linux-x64.rm
basic-cli/src/linux-x64.rh
basic-cli/src/linux-x64.o


build-linux-arm64-files:
runs-on: [self-hosted, Linux, ARM64]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3

- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v3

- name: build basic-cli
env:
CARGO_BUILD_TARGET: aarch64-unknown-linux-musl
CC_aarch64_unknown_linux_musl: clang-16
AR_aarch64_unknown_linux_musl: llvm-ar-16
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
run: ./ci/build_basic_cli.sh linux_arm64

- name: Save .o file
uses: actions/upload-artifact@v3
with:
name: linux-arm64-files
path: |
basic-cli/src/linux-arm64.o

build-macos-x86_64-files:
runs-on: [macos-11] # I expect the generated files to work on macOS 12
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and up
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3
Expand All @@ -65,7 +92,7 @@ jobs:
with:
name: macos-x86_64-files
path: |
basic-cli/src/macos-x86_64.o
basic-cli/src/macos-x64.o

build-macos-apple-silicon-files:
name: build apple silicon .o file
Expand All @@ -87,7 +114,7 @@ jobs:
basic-cli/src/macos-arm64.o

create-release-archive:
needs: [build-linux-x86_64-files, build-macos-x86_64-files, build-macos-apple-silicon-files]
needs: [build-linux-x86_64-files, build-linux-arm64-files, build-macos-x86_64-files, build-macos-apple-silicon-files]
name: create release archive
runs-on: [ubuntu-20.04]
steps:
Expand All @@ -100,7 +127,7 @@ jobs:
uses: actions/download-artifact@v3

- name: mv roc nightly and simplify name
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux") ./roc_nightly.tar.gz
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz

- name: decompress the tar
run: tar -xzvf roc_nightly.tar.gz
Expand All @@ -117,6 +144,8 @@ jobs:

- run: cp linux-x86_64-files/* ./basic-cli/src

- run: cp linux-arm64-files/* ./basic-cli/src

- run: cp macos-x86_64-files/* ./basic-cli/src

- run: ./roc_nightly/roc build --bundle=${{ env.ARCHIVE_FORMAT }} ./basic-cli/src/main.roc
Expand All @@ -139,7 +168,7 @@ jobs:
uses: actions/download-artifact@v3

- name: mv roc nightly and simplify name
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux") ./roc_nightly.tar.gz
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz

- name: decompress the tar
run: tar -xzvf roc_nightly.tar.gz
Expand All @@ -159,21 +188,31 @@ jobs:
cd basic-cli-platform && ls | grep "tar" | xargs brotli -d
ls | grep "tar$" | xargs tar -xf

- name: prep testing http-get.roc
- name: Install expect for tests if we dont have it yet
run: if ! dpkg -l | grep -qw expect; then sudo apt install -y expect; fi

- name: Install ncat for tests if we dont have it yet
run: if ! dpkg -l | grep -qw ncat; then sudo apt install -y ncat; fi

- name: prep testing
run: |
mv roc_nightly basic-cli-platform/.
cd basic-cli-platform
mkdir examples
cd examples
curl -fOL https://raw.githubusercontent.com/roc-lang/basic-cli/main/examples/http-get.roc
sed -i 's/pf:\ \"[^"]*/pf:\ \"\.\.\/main.roc/g' http-get.roc
cd ..
curl -fOL https://raw.githubusercontent.com/roc-lang/basic-cli/main/ci/expect_scripts/http-get.exp

- run: sudo apt install -y expect

- name: execute test
mkdir src
find . -maxdepth 1 -type f -exec mv {} src/ \;

mkdir temp-basic-cli
cd temp-basic-cli
git clone https://github.com/roc-lang/basic-cli.git
cd basic-cli
git checkout ${{ env.BASIC_CLI_BRANCH }}
cp -r examples ../..
cp -r ci ../..
cp -r LICENSE ../..
# LICENSE is necessary for command test

- name: run tests
run: |
cd basic-cli-platform
expect http-get.exp
ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ROC_BUILD_FLAGS=--prebuilt-platform ./ci/all_tests.sh

164 changes: 164 additions & 0 deletions .github/workflows/basic_webserver_build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
on:
# pull_request:
workflow_dispatch:

# this cancels workflows currently in progress if you start a new one
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.br
BASIC_WEBSERVER_BRANCH: main

jobs:
fetch-releases:
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3

- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz

- name: Save roc_nightly archives
uses: actions/upload-artifact@v3
with:
path: roc_nightly-*

build-linux-x86_64-files:
runs-on: [ubuntu-20.04]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3

- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v3

- name: build basic-webserver with surgical linker and also with legacy linker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only seems to do it with legacy linker...
Is that a mistake in the name or the implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistake in the name, I'll fix it in a future PR.

env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: ./ci/build_basic_webserver.sh linux_x86_64 "--linker legacy"

- name: Save .rh, .rm and .o file
uses: actions/upload-artifact@v3
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


build-linux-arm64-files:
runs-on: [self-hosted, Linux, ARM64]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3

- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v3

- name: build basic-webserver
env:
CARGO_BUILD_TARGET: aarch64-unknown-linux-musl
CC_aarch64_unknown_linux_musl: clang-16
AR_aarch64_unknown_linux_musl: llvm-ar-16
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
uses: actions/upload-artifact@v3
with:
name: linux-arm64-files
path: |
basic-webserver/platform/linux-arm64.o

build-macos-x86_64-files:
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and 13
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3

- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v3

- run: ./ci/build_basic_webserver.sh macos_x86_64

- name: Save .o files
uses: actions/upload-artifact@v3
with:
name: macos-x86_64-files
path: |
basic-webserver/platform/macos-x64.o

build-macos-apple-silicon-files:
name: build apple silicon .o file
runs-on: [self-hosted, macOS, ARM64]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v3

- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v3

- run: ./ci/build_basic_webserver.sh macos_apple_silicon

- name: Save macos-arm64.o file
uses: actions/upload-artifact@v3
with:
name: macos-apple-silicon-files
path: |
basic-webserver/platform/macos-arm64.o

create-release-archive:
needs: [build-linux-x86_64-files, build-linux-arm64-files, build-macos-x86_64-files, build-macos-apple-silicon-files]
name: create release archive
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3

- name: remove all folders except the ci folder
run: ls | grep -v ci | xargs rm -rf

- name: Download the previously uploaded files
uses: actions/download-artifact@v3

- name: mv roc nightly and simplify name
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz

- name: decompress the tar
run: tar -xzvf roc_nightly.tar.gz

- name: delete tar
run: rm roc_nightly.tar.gz

- name: rename nightly folder
run: mv roc_nightly* roc_nightly

- run: |
git clone https://github.com/roc-lang/basic-webserver.git
cd basic-webserver
git checkout ${{ env.BASIC_WEBSERVER_BRANCH }}
cd ..

- run: cp macos-apple-silicon-files/* ./basic-webserver/platform

- run: cp linux-x86_64-files/* ./basic-webserver/platform

- run: cp linux-arm64-files/* ./basic-webserver/platform

- run: cp macos-x86_64-files/* ./basic-webserver/platform

- run: ./roc_nightly/roc build --bundle=${{ env.ARCHIVE_FORMAT }} ./basic-webserver/platform/main.roc

- run: echo "TAR_FILENAME=$(ls -d basic-webserver/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV

- name: Upload platform archive
uses: actions/upload-artifact@v3
with:
name: basic-webserver-platform
path: |
${{ env.TAR_FILENAME }}
16 changes: 13 additions & 3 deletions ci/build_basic_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ set -euxo pipefail

git clone https://github.com/roc-lang/basic-cli.git

if [ "$(uname -m)" == "x86_64" ] && [ "$(uname -s)" == "Linux" ]; then
sudo apt-get install musl-tools
if [ "$(uname -s)" == "Linux" ]; then

# check if musl-tools is installed
if ! dpkg -l | grep -q musl-tools; then
# install musl-tools with timeout for sudo problems with CI
timeout 300s sudo apt-get install -y musl-tools
fi

cd basic-cli/src # we cd to install the target for the right rust version
rustup target add x86_64-unknown-linux-musl
if [ "$(uname -m)" == "x86_64" ]; then
rustup target add x86_64-unknown-linux-musl
elif [ "$(uname -m)" == "aarch64" ]; then
rustup target add aarch64-unknown-linux-musl
fi
cd ../..
fi

Expand Down
Loading