Skip to content

WIP prep basic-cli 0.6 release #135

WIP prep basic-cli 0.6 release

WIP prep basic-cli 0.6 release #135

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
# use .tar.gz for quick testing
env:
ARCHIVE_FORMAT: .tar.gz
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-cli with surgical linker and also with legacy linker
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: ./ci/build_basic_cli.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-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 with surgical linker and also with legacy linker
env:
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
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
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_cli.sh macos_x86_64
- name: Save .o files
uses: actions/upload-artifact@v3
with:
name: macos-x86_64-files
path: |
basic-cli/src/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_cli.sh macos_apple_silicon
- name: Save macos-arm64.o file
uses: actions/upload-artifact@v3
with:
name: macos-apple-silicon-files
path: |
basic-cli/src/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-cli.git
- run: cp macos-apple-silicon-files/* ./basic-cli/src
- 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
- run: echo "TAR_FILENAME=$(ls -d basic-cli/src/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
- name: Upload platform archive
uses: actions/upload-artifact@v3
with:
name: basic-cli-platform
path: |
${{ env.TAR_FILENAME }}
test-release-ubuntu:
needs: [create-release-archive]
runs-on: [ubuntu-20.04]
steps:
- 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
- if: contains(env.ARCHIVE_FORMAT, 'gz')
run: |
cd basic-cli-platform && ls | grep "tar" | xargs tar -xzf
- if: contains(env.ARCHIVE_FORMAT, 'br')
run: |
cd basic-cli-platform && ls | grep "tar" | xargs brotli -d
ls | grep "tar$" | xargs tar -xf
- name: prep testing http-get.roc
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 ..
./roc_nightly/roc build examples/http-get.roc --prebuilt-platform
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
run: |
cd basic-cli-platform
expect http-get.exp