Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Add linux-aarch64 GitHub actions via QEMU (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
lnihlen committed Oct 3, 2022
1 parent 22d0e29 commit f798d8b
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 130 deletions.
113 changes: 0 additions & 113 deletions .github/workflows/actions.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: linter
on: [push, pull_request]
jobs:
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cpp-linter/cpp-linter-action@v2
id: linter
with:
style: file
files-changed-only: false
# TODO: enable clang-tidy checks
tidy-checks: -*
- name: Linter Failed
if: steps.linter.outputs.checks-failed > 0
run: exit 1
37 changes: 37 additions & 0 deletions .github/workflows/test-linux-qemu-aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test-linux-qemu-aarch64
on: [push, pull_request]
jobs:
# GitHub action testing of aarch64 on linux under emulation using https://github.com/uraimo/run-on-arch-action
test-linux-qemu-aarch64:
runs-on: ubuntu-latest
env:
SRC_PATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: uraimo/run-on-arch-action@v2
name: run commands
with:
arch: aarch64
distro: ubuntu_latest
setup: |
mkdir -p "$SRC_PATH/build"
dockerRunArgs: |
--volume "$SRC_PATH:/hadron"
install: |
export BUILD_PATH=/hadron/build
apt-get update
apt-get install --yes ninja-build cmake bison ragel gperf build-essential curl git default-jre-headless
git config --global --add safe.directory /hadron
run: |
export BUILD_PATH=/hadron/build
mkdir -p $BUILD_PATH/install-ext/{lib,bin}
cd $BUILD_PATH/install-ext/lib
curl -O https://www.antlr.org/download/antlr-4.11.1-complete.jar
cd $BUILD_PATH
echo $'#!/bin/bash\njava -Xmx500M -cp "${BUILD_PATH}/install-ext/lib/antlr-4.11.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool $@' > $BUILD_PATH/install-ext/bin/antlr4
chmod a+x $BUILD_PATH/install-ext/bin/antlr4
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DANTLR_COMMAND_LINE=$BUILD_PATH/install-ext/bin/antlr4 ..
cmake --build .
ctest -C Debug -T test --output-on-failure
34 changes: 34 additions & 0 deletions .github/workflows/test-linux-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test-linux-x86_64
on: [push, pull_request]
jobs:
test-linux-x86_64:
runs-on: ubuntu-latest
env:
BUILD_PATH: ${{ github.workspace }}/build
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes ninja-build cmake bison ragel gperf build-essential
mkdir -p $BUILD_PATH/install-ext/{lib,bin}
cd $BUILD_PATH/install-ext/lib
curl -O https://www.antlr.org/download/antlr-4.11.1-complete.jar
cd $BUILD_PATH
echo '#!/bin/bash
java -Xmx500M -cp "${BUILD_PATH}/install-ext/lib/antlr-4.11.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool $@' > $BUILD_PATH/install-ext/bin/antlr4
chmod u+x $BUILD_PATH/install-ext/bin/antlr4
- name: configure
run: |
cd $BUILD_PATH
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DANTLR_COMMAND_LINE=$BUILD_PATH/install-ext/bin/antlr4 ..
- name: build
run: |
cd $BUILD_PATH
cmake --build .
- name: test
run: |
cd $BUILD_PATH
ctest -C Debug -T test --output-on-failure
26 changes: 26 additions & 0 deletions .github/workflows/test-macos-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test-macos-x86_64
on: [push, pull_request]
jobs:
test-macos-x86_64:
runs-on: macos-latest
env:
BUILD_PATH: ${{ github.workspace }}/build
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: install dependencies
run: |
brew install cmake bison gperf ragel antlr ninja
- name: configure
run: |
mkdir $BUILD_PATH && cd $BUILD_PATH
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ..
- name: build
run: |
cd $BUILD_PATH
cmake --build .
- name: test
run: |
cd $BUILD_PATH
ctest -C Debug -T test --output-on-failure
36 changes: 36 additions & 0 deletions .github/workflows/test-windows-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: test-windows-x86_64
on: [push, pull_request]
jobs:
test-windows-x86_64:
runs-on: windows-latest
env:
BUILD_PATH: ${{ github.workspace }}\build
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: install dependencies
shell: bash
run: |
vcpkg install --triplet x64-windows ragel gperf
mkdir -p $BUILD_PATH/install-ext/{lib,bin}
cd $BUILD_PATH/install-ext/lib
curl -O https://www.antlr.org/download/antlr-4.11.1-complete.jar
cd $BUILD_PATH
export NEWER_JAVA=`where java | tail -n1`
echo "\"$NEWER_JAVA\" -cp \"$BUILD_PATH\\install-ext\\lib\\antlr-4.11.1-complete.jar\" org.antlr.v4.Tool %*" > $BUILD_PATH/install-ext/bin/antlr4.bat
- name: configure
shell: bash
run: |
cd $BUILD_PATH
cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake -DANTLR_COMMAND_LINE=$BUILD_PATH/install-ext/bin/antlr4.bat -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Debug ..
- name: build
shell: bash
run: |
cd $BUILD_PATH
cmake --build . --config=Debug
- name: test
shell: bash
run: |
cd $BUILD_PATH
ctest -C Debug -T test --output-on-failure
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Hadron

Hadron is a re-implementation of the [SuperCollider](https://supercollider.github.io/) language interpreter, designed to
Just-In-Time (JIT) compile SuperCollider code into machine code instructions. Hadron is in early development stage and
is not ready for use, but will hopefully one day be useful for the SuperCollider community.
Just-In-Time (JIT) compile SuperCollider code into machine code instructions. Hadron is in the pre-alpha development
stage and is not ready for use, but will hopefully one day be useful for the SuperCollider community.

The goals of Hadron are to make the SuperCollider language a *faster*, more *extensible*, and more *usable* programming
language than ever before.

## Execution Speed

Hadron compiles blocks of SuperCollider code into machine code for execution directly on the host microprocessor.
Balancing against compilation speed, it makes a best effort to pack local variables into processor registers, and to
Balancing against compilation speed, it makes an effort to pack local variables into processor registers, and to
deduce types of variables to "narrow down" the possible types of values to inline and optimize code at compile time as
much as can be done on a dynamically-typed programming language.

Expand Down
4 changes: 2 additions & 2 deletions src/hadron/Lexer.rl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
# string literals #
###################
# Double-quoted string.
'"' (('\\' any %hasEscape) | (extend - ('"' | '\\')))* '"' {
'"' (('\\' any %hasEscape) | (any - ('"' | '\\')))* '"' {
m_tokens.emplace_back(Token::makeString(std::string_view(ts + 1, te - ts - 2), getLocation(ts + 1),
hasEscapeChars));
hasEscapeChars = false;
Expand All @@ -100,7 +100,7 @@
# symbols #
###########
# Single-quoted symbol.
'\'' (('\\' any %hasEscape) | (extend - ('\'' | '\\')))* '\'' {
'\'' (('\\' any %hasEscape) | (any - ('\'' | '\\')))* '\'' {
m_tokens.emplace_back(Token::makeSymbol(std::string_view(ts + 1, te - ts - 2), getLocation(ts + 1),
hasEscapeChars));
hasEscapeChars = false;
Expand Down
24 changes: 12 additions & 12 deletions src/hadron/Lexer_unittests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ TEST_CASE("Lexer Strings") {
CHECK(!lexer.tokens()[1].escapeString);
}
SUBCASE("extended characters in string") {
const char* code = "\"(╯°□°)╯︵ ┻━┻\"";
Lexer lexer(code);
std::string code = u8"\"(╯°□°)╯︵ ┻━┻\"";
Lexer lexer(code.data());
REQUIRE(lexer.lex());
REQUIRE(lexer.tokens().size() == 1);
CHECK(lexer.tokens()[0].name == Token::Name::kString);
CHECK(lexer.tokens()[0].range.data() == code + 1);
CHECK(lexer.tokens()[0].range.size() == std::strlen(code) - 2);
CHECK(lexer.tokens()[0].range.data() == code.data() + 1);
CHECK(lexer.tokens()[0].range.size() == std::strlen(code.data()) - 2);
CHECK(!lexer.tokens()[0].escapeString);
}
SUBCASE("unterminated string") {
Expand Down Expand Up @@ -569,13 +569,13 @@ TEST_CASE("Lexer Symbols") {
CHECK(!lexer.tokens()[8].escapeString);
}
SUBCASE("extended characters in quote symbols") {
const char* code = "'🖤💛💙💜💚🧡'";
Lexer lexer(code);
std::string code = u8"'🖤💛💙💜💚🧡'";
Lexer lexer(code.data());
REQUIRE(lexer.lex());
REQUIRE(lexer.tokens().size() == 1);
CHECK(lexer.tokens()[0].name == Token::kSymbol);
CHECK(lexer.tokens()[0].range.data() == code + 1);
CHECK(lexer.tokens()[0].range.size() == std::strlen(code) - 2);
CHECK(lexer.tokens()[0].range.data() == code.data() + 1);
CHECK(lexer.tokens()[0].range.size() == std::strlen(code.data()) - 2);
CHECK(!lexer.tokens()[0].escapeString);
}
}
Expand Down Expand Up @@ -1705,8 +1705,8 @@ TEST_CASE("Lexer Comments") {
CHECK(lexer.tokens()[0].range.size() == 1);
}
SUBCASE("line comment extended chars") {
const char* code = "// 寧為太平犬,不做亂世人\n";
Lexer lexer(code);
std::string code = u8"// 寧為太平犬,不做亂世人\n";
Lexer lexer(code.data());
REQUIRE(lexer.lex());
REQUIRE(lexer.tokens().size() == 0);
}
Expand Down Expand Up @@ -1776,8 +1776,8 @@ TEST_CASE("Lexer Comments") {
CHECK(lexer.tokens()[1].range.compare("a") == 0);
}
SUBCASE("block comment extended characters") {
const char* code = "/* // ✌️a */";
Lexer lexer(code);
std::string code = u8"/* // ✌️a */";
Lexer lexer(code.data());
REQUIRE(lexer.lex());
REQUIRE(lexer.tokens().size() == 0);
}
Expand Down

0 comments on commit f798d8b

Please sign in to comment.