Skip to content

Align ION_SPEC with the compiler and fix Ion snippets in the spec and… #87

Align ION_SPEC with the compiler and fix Ion snippets in the spec and…

Align ION_SPEC with the compiler and fix Ion snippets in the spec and… #87

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.96.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo build --bin ion-lsp
- run: cargo test
- run: cargo clippy -- -D warnings
- run: cargo build --release --bin ion-compiler --bin ion-lsp --bin ion-build
- run: ./target/release/ion-compiler --version
- run: ./target/release/ion-build --version
- name: Integration tests (Linux)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
ION_BUILD: ${{ github.workspace }}/target/release/ion-build
run: cd tests && bash test_runner.sh
- name: Generated C sanitizer smoke (Linux)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
CC: gcc
CFLAGS: -fsanitize=address,undefined -fno-omit-frame-pointer
LDFLAGS: -fsanitize=address,undefined
ASAN_OPTIONS: detect_leaks=0
UBSAN_OPTIONS: halt_on_error=1
run: |
cd tests
"$CC" $CFLAGS -c ../runtime/ion_runtime.c -I. -I.. -I../runtime -o .ion_test_runtime_san.o
while IFS=' ' read -r test expected; do
"$COMPILER" "$test.ion" >/dev/null
"$CC" $CFLAGS "$test.c" .ion_test_runtime_san.o -I. -I.. -I../runtime -lpthread $LDFLAGS -o "$test"
set +e
"./$test" >/dev/null
status=$?
set -e
if [ "$status" -ne "$expected" ]; then
echo "$test: expected exit $expected, got $status"
exit 1
fi
rm -f "$test.c" "$test"
done <<'EOF'
test_basic 42
test_vec_push_pop 0
test_string_push_byte 79
test_spawn_channel 0
test_array_to_slice_coercion 10
EOF
- name: Generated C thread sanitizer (Linux)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
CC: gcc
CFLAGS: -fsanitize=thread -fno-omit-frame-pointer
LDFLAGS: -fsanitize=thread
run: |
cd tests
"$CC" $CFLAGS -c ../runtime/ion_runtime.c -I. -I.. -I../runtime -o .ion_test_runtime_tsan.o
while IFS=$'\t' read -r test kind expected _rest; do
[ "$kind" = "run" ] || continue
case "$test" in
test_channel_*|test_spawn_*) ;;
*) continue ;;
esac
[ -f "${test}.ion" ] || continue
"$COMPILER" "${test}.ion" >/dev/null
"$CC" $CFLAGS "${test}.c" .ion_test_runtime_tsan.o -I. -I.. -I../runtime -lpthread $LDFLAGS -o "$test"
set +e
"./$test" >/dev/null
status=$?
set -e
if [ "$status" -ne "$expected" ]; then
echo "$test: expected exit $expected, got $status"
exit 1
fi
rm -f "${test}.c" "$test"
done < <(awk -F '\t' 'NR > 1 && $2 == "run" && ($1 ~ /^test_channel_/ || $1 ~ /^test_spawn_/) { print $1, $2, $3 }' test_expectations.tsv)
- name: Large codegen smoke (Linux)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
CC: gcc
CFLAGS: -Wall -Wextra -Werror
run: bash tests/large_codegen_smoke.sh
- name: Generated C warning-clean (Linux)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
ION_BUILD: ${{ github.workspace }}/target/release/ion-build
CC: gcc
CFLAGS: -Wall -Wextra -Werror
RUNTIME_OBJ: .ion_test_runtime_werror.o
run: cd tests && bash test_runner.sh
integration:
permissions:
contents: read
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.96.0
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --bin ion-compiler --bin ion-build
- name: Integration tests (Windows)
shell: bash
env:
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
ION_BUILD: ${{ github.workspace }}/target/release/ion-build
run: cd tests && bash test_runner.sh