Skip to content

Build and run tests in a dev container #422

Build and run tests in a dev container

Build and run tests in a dev container #422

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths:
- '.github/workflows/ci.yml'
- '**/*.cpp'
- '**/*.hpp'
- '**/CMakeLists.txt'
pull_request:
branches:
- main
paths:
- '.github/workflows/ci.yml'
- '**/*.cpp'
- '**/*.hpp'
- '**/CMakeLists.txt'
jobs:
code-style-check:
name: Code style check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.13
with:
source: '.'
exclude: './thirdparty ./docs'
extensions: 'hpp,cpp'
clangFormatVersion: 12
build-gcc:
name: Build on Ubuntu GCC
runs-on: ubuntu-latest
needs: code-style-check
container:
image: ghcr.io/vla5924-practice/compiler-project/devcontainer:1710845516
options: --user root
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- name: Initialize repository
uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_IR_GENERATOR=OFF
ninja -C build
- name: Archive binaries
uses: actions/upload-artifact@v4
with:
name: binaries-ubuntu-latest-gcc
path: build/bin
unit-test:
name: Unit test
runs-on: ubuntu-latest
needs: build-gcc
container:
image: ghcr.io/vla5924-practice/compiler-project/devcontainer:1710845516
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries-ubuntu-latest-gcc
- name: Run ast_test
run: ./bin/ast_test
- name: Run backend_test
run: ./bin/backend_test