feat: build hermit with fast-jit wamr #42
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
name: CI | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-binaries: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup cosmocc | |
run: | | |
sudo mkdir -p /opt/cosmocc | |
cd /opt/cosmocc | |
sudo wget https://cosmo.zip/pub/cosmocc/cosmocc.zip | |
sudo unzip cosmocc.zip | |
export PATH="/opt/cosmocc/bin:$PATH" | |
- name: Install ape loader | |
run: | | |
sudo cp /opt/cosmocc/bin/ape-$(uname -m).elf /usr/bin/ape | |
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" | |
- name: Install deps | |
run: | | |
curl https://wasmtime.dev/install.sh -sSf | bash | |
rustup target add wasm32-wasi | |
cd dockerfile-parser-rs/third-party/pest | |
cargo build --package pest_bootstrap | |
- name: Build APEs | |
run: | | |
export PATH="/opt/cosmocc/bin:$PATH" | |
cosmocc --version | |
export WASMTIME_HOME="$HOME/.wasmtime" | |
export PATH="$WASMTIME_HOME/bin:$PATH" | |
wasmtime --version | |
./build_hermit.sh | |
- name: upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hermit | |
path: | | |
build/hermit.com | |
build/cat.hermit.com | |
build/count_vowels.hermit.com | |
build/cowsay.hermit.com | |
test: | |
name: Test ${{ matrix.os }} | |
needs: [build-binaries] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- name: Install APE loader on Ubuntu | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
shell: bash | |
run: | | |
sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf | |
sudo chmod +x /usr/bin/ape | |
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" | |
- name: Download APEs | |
uses: actions/download-artifact@v3 | |
- name: Test APEs (no output on NT?) | |
shell: bash | |
run: | | |
chmod +x hermit/* | |
hermit/cowsay.hermit.com hello | |
echo aaa | hermit/cowsay.hermit.com | |
echo aaa > text.txt | |
hermit/cat.hermit.com text.txt | |
- name: Test, but not on the New Technology | |
if: ${{ matrix.os != 'windows-latest' }} | |
shell: bash | |
run: | | |
[[ $(echo aeiou | hermit/count_vowels.hermit.com) == 5 ]] | |
[[ $(echo bcd | hermit/count_vowels.hermit.com) == 0 ]] | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: [ build-binaries, test ] | |
steps: | |
- name: Fetch build artifacts | |
if: ${{ github.ref_type == 'tag' }} | |
uses: actions/download-artifact@v3 | |
- name: Publish release | |
if: ${{ github.ref_type == 'tag' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
hermit/hermit.com | |
hermit/cat.hermit.com | |
hermit/count_vowels.hermit.com | |
hermit/cowsay.hermit.com |