Merge pull request #37 from ashelkovnykov/moar-ci

Add CI for Hoon code
This commit is contained in:
Alex Shelkovnykov 2023-03-07 02:57:12 +01:00 committed by GitHub
commit 7ed735e1e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 221 additions and 28 deletions

34
.github/scripts/hoon/boot-ship.sh vendored Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
set -xeuo pipefail
PILL_NAME='solid.pill'
curl -L $URBIT_URL | tar xzk --transform='s/.*/urbit/g'
curl -L $PILL_URL -o $PILL_NAME
./urbit \
--bootstrap $PILL_NAME \
--local \
--lite-boot \
--daemon \
--fake bus \
-c $URBIT_PIER
LENS_PORT=$(grep 'loopback' $URBIT_PIER/.http.ports | awk -F ' ' '{print $1}')
lensecho() {
curl -s \
--data '{"source":{"data":"'"$1"'"},"sink":{"stdout":null}}' \
"http://localhost:$LENS_PORT" | xargs printf %s | sed 's/\\n//g'
}
check() {
[ "'3'" == "$(lensecho 3)" ]
}
if check; then
echo "boot success"
else
echo "boot failure"
exit 1
fi

66
.github/scripts/hoon/setup-ship.sh vendored Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
set -xeuo pipefail
DESK_DIR="$URBIT_PIER/$DESK"
DESK_LIB_DIR="$DESK_DIR/lib"
DESK_TST_DIR="$DESK_DIR/tests"
LENS_PORT=$(grep 'loopback' $URBIT_PIER/.http.ports | awk -F ' ' '{print $1}')
lensapp() {
curl -s --max-time 10 \
--data '{"source":{"dojo":"'"$2"'"},"sink":{"app":"'"$1"'"}}' \
"http://localhost:$LENS_PORT"
}
lensdojo() {
curl -s --max-time 10 \
--data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' \
"http://localhost:$LENS_PORT"
}
# XX: temporary; eventually should actually load files as pills
lensapp 'hood' "+hood/merge %$DESK our %base"
lensapp 'hood' "+hood/rm /=$DESK=/desk/bill"
lensapp 'hood' "+hood/rm /=$DESK=/sys/hoon/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/arvo/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/lull/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/zuse/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/ames/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/behn/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/clay/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/dill/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/eyre/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/gall/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/iris/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/jael/hoon"
lensapp 'hood' "+hood/rm /=$DESK=/sys/vane/khan/hoon"
lensapp 'hood' "+hood/mount %$DESK"
cp -rfL ./hoon/scaffolding/azimuth-pill.hoon $DESK_DIR
cp -rfL ./hoon/scaffolding/baby.hoon $DESK_DIR
cp -rfL ./hoon/scaffolding/cradle.hoon $DESK_LIB_DIR
cp -rfL ./hoon/scaffolding/naive-cradle.hoon $DESK_LIB_DIR
cp -rfL ./hoon/scaffolding/logs.jam $DESK_LIB_DIR
cp -rfL ./hoon/scaffolding/mainnet.azimuth-snapshot $DESK_LIB_DIR
lensapp 'hood' "+hood/commit %$DESK"
# XX: No tests yet
#mkdir $DESK_TST_DIR
# cp -rfL ./hoon/scaffolding/tests/* $DESK_TST_DIR
# XX: redo when conn.c cli available
check() {
[ -z "$(lensdojo "-build-file /=$DESK=/$1/hoon" | grep 'thread failed')" ]
}
if check 'baby' && check 'azimuth-pill'; then
echo "boot success"
else
echo "boot failure"
exit 1
fi

13
.github/scripts/hoon/test-ship.sh vendored Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -xeuo pipefail
LENS_PORT=$(grep 'loopback' $URBIT_PIER/.http.ports | awk -F ' ' '{print $1}')
lensdojo() {
curl -s \
--data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' \
"http://localhost:$LENS_PORT"
}
# XX: redo when conn.c cli available; just runs tests whether they pass or fail
lensdojo "-test /=$DESK=/tests ~"

14
.github/workflows/ares-feature.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: 'Ares: Pull request'
on:
pull_request:
paths:
- '.github/workflows/ares-feature.yml'
- '.github/workflows/ares-shared.yml'
- 'rust/ares/**'
- 'rust/ares_macros/**'
- 'rust/ibig-rs/**'
jobs:
urbit:
uses: ./.github/workflows/ares-shared.yml

27
.github/workflows/ares-shared.yml vendored Normal file
View File

@ -0,0 +1,27 @@
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: rust/ares
jobs:
build:
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Format
run: cargo fmt --check
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

16
.github/workflows/ares-status.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: 'Ares: Push to status'
on:
push:
branches:
- status
paths:
- '.github/workflows/ares-shared.yml'
- '.github/workflows/ares-status.yml'
- 'rust/ares/**'
- 'rust/ares_macros/**'
- 'rust/ibig-rs/**'
jobs:
urbit:
uses: ./.github/workflows/ares-shared.yml

View File

@ -1,28 +0,0 @@
name: Ares
on:
push:
branches: [ "status" ]
pull_request:
branches: [ "status" ]
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: rust/ares
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Format
run: cargo fmt --check
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

13
.github/workflows/hoon-feature.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: 'Hoon: Pull request'
on:
pull_request:
paths:
- '.github/scripts/hoon/**.yml'
- '.github/workflows/hoon-feature.yml'
- '.github/workflows/hoon-shared.yml'
- 'hoon/scaffolding/**'
jobs:
urbit:
uses: ./.github/workflows/hoon-shared.yml

23
.github/workflows/hoon-shared.yml vendored Normal file
View File

@ -0,0 +1,23 @@
on:
workflow_call:
env:
URBIT_URL: 'https://urbit.org/install/linux-x86_64/latest'
PILL_URL: 'https://github.com/urbit/urbit/raw/master/bin/solid.pill'
URBIT_PIER: './pier'
DESK: 'sandbox'
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- name: 'Boot fake ship'
run: ./.github/scripts/hoon/boot-ship.sh
- name: 'Setup fake ship'
run: ./.github/scripts/hoon/setup-ship.sh
- name: 'Test fake ship'
run: ./.github/scripts/hoon/test-ship.sh

15
.github/workflows/hoon-status.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: 'Hoon: Push to status'
on:
push:
branches:
- status
paths:
- '.github/scripts/hoon/**.yml'
- '.github/workflows/hoon-shared.yml'
- '.github/workflows/hoon-status.yml'
- 'hoon/scaffolding/**'
jobs:
urbit:
uses: ./.github/workflows/hoon-shared.yml