Skip to content

Commit

Permalink
Merge pull request #24 from jackparsonss/jparsons/ci
Browse files Browse the repository at this point in the history
CI/CD
  • Loading branch information
jackparsonss committed Jun 24, 2024
2 parents a37c25c + 3bf0fe4 commit 09bbeea
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: self-hosted
defaults:
run:
working-directory: ./scripts

container:
image: aizuko/gazprea:v0.5

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: make executable
run: chmod +x entrypoint.sh

- name: build and test
run: ./entrypoint.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build/

fuse.ll
fuse.ll.stdout
lli-temp.out
93 changes: 93 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
FROM ubuntu:latest

RUN apt-get update -y
RUN apt-get install build-essential -y

RUN apt-get update -y
RUN apt-get install pkg-config -y

RUN apt-get update
RUN apt-get install uuid-dev -y

RUN apt-get update
RUN apt-get install openjdk-17-jre -y

RUN apt-get update
RUN apt-get install git -y

RUN apt-get update
RUN apt-get install cmake -y

RUN apt-get update
RUN apt-get install ninja-build -y

RUN apt-get update
RUN apt-get install curl -y

RUN mkdir /antlr
RUN cd /antlr && git clone https://github.com/antlr/antlr4.git
RUN cd /antlr/antlr4 && git checkout 4.13.1

RUN mkdir /antlr/antlr4/build
RUN mkdir /antlr/install
RUN cd /antlr/antlr4/build && cmake /antlr/antlr4/runtime/Cpp/ \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX="/antlr/install" && make install -j 8


RUN mkdir /antlr/install/bin
RUN curl https://www.antlr.org/download/antlr-4.13.1-complete.jar \
-o /antlr/install/bin/antlr.jar

RUN cd / && git clone https://github.com/llvm/llvm-project.git
RUN cd /llvm-project && git checkout llvmorg-16.0.6
RUN mkdir /llvm-project/build
RUN cd /llvm-project/build && cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=ON \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON

RUN cd /llvm-project/build && ninja check-all -j 8 || true

RUN cd / && git clone https://github.com/cmput415/Tester.git
RUN mkdir /Tester/build
RUN cd /Tester/build && cmake .. && make -j 8

RUN echo 'export ANTLR_INS="/antlr/install"' >> ~/.bashrc
RUN echo 'export ANTLR_JAR="/antlr/install/bin/antlr.jar"' >> ~/.bashrc
RUN echo 'export CLASSPATH="$ANTLR_JAR:$CLASSPATH"' >> ~/.bashrc
RUN echo 'alias antlr4="java -Xmx500M org.antlr.v4.Tool"' >> ~/.bashrc
RUN echo 'alias grun="java org.antlr.v4.gui.TestRig"' >> ~/.bashrc

RUN echo 'export MLIR_INS="/llvm-project/build/"' >> ~/.bashrc
RUN echo 'export MLIR_DIR="/llvm-project/build/lib/cmake/mlir/"' >> ~/.bashrc
RUN echo 'export PATH="/llvm-project/build/bin:$PATH"' >> ~/.bashrc

RUN echo 'export PATH="/Tester/bin/:$PATH"' >> ~/.bashrc

RUN rm -rf /llvm-project/bolt
RUN rm -rf /llvm-project/clang
RUN rm -rf /llvm-project/clang-tools-extra
RUN rm -rf /llvm-project/compiler-rt
RUN rm /llvm-project/CONTRIBUTING.md
RUN rm -rf /llvm-project/cross-project-tests
RUN rm -rf /llvm-project/flang
RUN rm -rf /llvm-project/libc
RUN rm -rf /llvm-project/libclc
RUN rm -rf /llvm-project/libcxx
RUN rm -rf /llvm-project/libcxxabi
RUN rm -rf /llvm-project/libunwind
RUN rm /llvm-project/LICENSE.TXT
RUN rm /llvm-project/SECURITY.md
RUN rm -rf /llvm-project/lld
RUN rm -rf /llvm-project/lldb
RUN rm -rf /llvm-project/openmp
RUN rm -rf /llvm-project/polly
RUN rm -rf /llvm-project/pstl
RUN rm -rf /llvm-project/third-party

SHELL ["/bin/bash", "-c"]

ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion include/shared/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Type {
std::string get_name() const;
mlir::Type get_mlir() const;

bool operator==(Type rhs) const;
bool operator==(const Type rhs) const;

static const Type ch;
static const Type i32;
Expand Down
13 changes: 13 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/bash

source ~/.bashrc

cd ../

mkdir build
cd build
cmake ..
make -j 5

cd ../tests
tester ./ci_config.json
File renamed without changes.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main(int argc, char** argv) {
assert(builder.has_ast());

// frontend args
for (unsigned i = 0; i < argc; i++) {
for (size_t i = 0; i < argc; i++) {
std::string arg = std::string(argv[i]);
if (arg == "--xml") {
builder.get_ast()->xml(0);
Expand All @@ -49,7 +49,7 @@ int main(int argc, char** argv) {
backend.traverse();

// backend args
for (unsigned i = 0; i < argc; i++) {
for (size_t i = 0; i < argc; i++) {
std::string arg = std::string(argv[i]);
if (arg == "--emit-llvm" && i == argc - 1) {
std::cerr << "You must provide a file to target llvm ir"
Expand Down
2 changes: 1 addition & 1 deletion src/shared/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Type::Type(std::string name) {
this->name = name;
}

bool Type::operator==(Type rhs) const {
bool Type::operator==(const Type rhs) const {
return this->name == rhs.name;
}

Expand Down
36 changes: 36 additions & 0 deletions tests/ci_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"inDir": "/__w/fusion/fusion/tests/input",
"outDir": "/__w/fusion/fusion/tests/output",
"testedExecutablePaths": {
"fusion": "/__w/fusion/fusion/bin/fuse"
},
"runtimes": {
"fusion": "/__w/fusion/fusion/bin/libfusert.so"
},
"toolchains": {
"fusion": [
{
"stepName": "fuse",
"executablePath": "$EXE",
"arguments": [
"$INPUT",
"--emit-llvm",
"$OUTPUT"
],
"output": "fuse.ll",
"allowError": true
},
{
"stepName": "lli",
"executablePath": "/root/llvm-project/build/bin/lli",
"arguments": [
"$INPUT"
],
"output": "-",
"usesRuntime": true,
"usesInStr": false,
"allowError": true
}
]
}
}

0 comments on commit 09bbeea

Please sign in to comment.