diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6b509ab..e831ccfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,8 +39,8 @@ jobs: extensions: 'hpp,cpp' clangFormatVersion: 17 - build-gcc: - name: Build on Ubuntu GCC + build-test-gcc: + name: Build and test (Ubuntu GCC) runs-on: ubuntu-latest needs: code-style-check container: @@ -62,6 +62,8 @@ jobs: git config --global --add safe.directory $(pwd) cmake -S compiler -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CODEGEN='ast_to_llvmir;optree_to_llvmir' cmake --build build --parallel + - name: Run tests + run: ctest --test-dir build --output-on-failure - name: Archive binaries run: tar cf binaries.tar -C build bin - name: Upload binaries @@ -70,8 +72,8 @@ jobs: name: binaries-ubuntu-latest-gcc path: binaries.tar - build-clang: - name: Build on Ubuntu Clang + build-test-clang: + name: Build and test (Ubuntu Clang) runs-on: ubuntu-latest needs: code-style-check container: @@ -92,9 +94,11 @@ jobs: run: | cmake -S compiler -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CODEGEN='ast_to_llvmir;optree_to_llvmir' cmake --build build --parallel + - name: Run tests + run: ctest --test-dir build --output-on-failure - build-msvc: - name: Build on Windows MSVC + build-test-msvc: + name: Build and test (Windows MSVC) runs-on: windows-latest needs: code-style-check steps: @@ -106,45 +110,13 @@ jobs: run: | cmake -S compiler -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel - - unit-test: - name: Unit test - runs-on: ubuntu-latest - needs: build-gcc - container: - image: ghcr.io/vla5924-practice/compiler-project/devcontainer:latest - options: --user root - credentials: - username: ${{ github.actor }} - password: ${{ secrets.github_token }} - steps: - - name: Download binaries - uses: actions/download-artifact@v4 - with: - name: binaries-ubuntu-latest-gcc - - name: Extract binaries - run: tar xf binaries.tar - - name: Run AST interface tests - run: ./bin/ast_test - - name: Run operation tree interface tests - run: ./bin/optree_test - - name: Run frontend tests - run: ./bin/frontend_test - - name: Run AST-based backend tests - run: ./bin/backend_ast_test - - name: Run optree-based backend tests - run: ./bin/backend_optree_test - - name: Run codegen tests (AST to LLVM IR) - run: ./bin/codegen_ast_to_llvmir_test - - name: Run codegen tests (optree to LLVM IR) - run: ./bin/codegen_optree_to_llvmir_test - - name: Run utility tests - run: ./bin/utils_test + - name: Run tests + run: ctest --test-dir build --output-on-failure code-coverage: name: Code coverage runs-on: ubuntu-latest - needs: build-gcc + needs: build-test-gcc container: image: ghcr.io/vla5924-practice/compiler-project/devcontainer:latest options: --user root @@ -209,7 +181,6 @@ jobs: - name: Build compilation database run: | cmake -S compiler -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CODEGEN='ast_to_llvmir;optree_to_llvmir' - cmake --build build --parallel - name: Run clang-tidy analysis run: | git diff -U0 origin/main | clang-tidy-diff -p1 -path build > clang-tidy.log