Build DDP and run tests #476
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build DDP and run tests | |
on: | |
push: | |
branches: [ "master", "dev" ] | |
pull_request: | |
branches: [ "master", "dev" ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
env: | |
DDPPATH: ${{ github.workspace }}/build/DDP/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup and Cache Go | |
uses: magnetikonline/action-golang-cache@v5 | |
with: | |
go-version-file: go.mod | |
cache-key-suffix: kompilierer | |
- name: Setup LLVM | |
if: runner.os == 'Linux' | |
run: sudo apt install llvm-12 | |
- name: Cache LLVM | |
if: runner.os == 'Windows' | |
id: cache-llvm | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/llvm_build/ | |
key: ${{ runner.os }}-llvm-build-${{ hashFiles('**/Makefile', '**/cmd/Makefile') }} | |
restore-keys: | | |
${{ runner.os }}-llvm-build- | |
- name: Download Prebuilt LLVM | |
if: runner.os == 'Windows' && steps.cache-llvm.outputs.cache-hit != 'true' | |
run: | | |
curl -L -o ./llvm_build.tar.gz https://github.com/DDP-Projekt/Kompilierer/releases/download/llvm-binaries/llvm_build-mingw-12.2.0-x86_64-ucrt-posix-seh.tar.gz | |
mkdir -p ./llvm_build/ | |
tar -xzf ./llvm_build.tar.gz -C ./ --force-local | |
rm ./llvm_build.tar.gz | |
- name: Get german locale | |
run: sudo locale-gen de_DE.UTF-8 | |
if: runner.os == 'Linux' | |
- name: Set Env | |
if: runner.os == 'Windows' | |
run: | | |
echo "CGO_CPPFLAGS=$('${{ github.workspace }}/llvm_build/bin/llvm-config' --cppflags)" >> $GITHUB_ENV | |
echo "CGO_LDFLAGS=$('${{ github.workspace}}/llvm_build/bin/llvm-config' --ldflags --libs --system-libs all | tr '\r\n' ' ')" >> $GITHUB_ENV | |
echo "CGO_CXXFLAGS=-std=c++14" >> $GITHUB_ENV | |
- name: Cache External Libs | |
id: cache-external | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ github.workspace }}/lib/external/*.a | |
${{ github.workspace }}/lib/external/*_build/ | |
key: ${{ runner.os }}-external-${{ hashFiles('**/lib/external/Makefile', '**/.gitmodules') }} | |
restore-keys: | | |
${{ runner.os }}-external | |
- name: Build | |
run: | | |
make -j4 ${{ steps.cache-external.outputs.cache-hit == 'true' && '--old-file=lib/external/*.a' || '' }} | |
- name: Run tests | |
run: make test | |
- name: Upload Coverage Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-${{ runner.os }} | |
path: tests/coverage.md | |
retention-days: 30 |