Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions #3

Open
wants to merge 22 commits into
base: vmihalko-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cd732a6
parser: add std::optional
vmihalko May 13, 2023
7bd11a0
fixup! parser: add std::optional
vmihalko May 13, 2023
ad6a194
parser: add check for null in arrayBaseType
vmihalko May 13, 2023
f21d903
parser: revert and add TODO: fix redundantCastPass
vmihalko May 13, 2023
ea4236d
fixup! fixup! parser: parse anonymous structs/unions
vmihalko May 13, 2023
afdae14
fixup! fixup! fixup! parser: parse anonymous structs/unions
vmihalko May 13, 2023
277930b
parser: fix void type inside derived types
vmihalko May 13, 2023
dd6745b
fixup! parser: fix void type inside derived types
vmihalko May 13, 2023
ac4f68e
parser: DIfunction might parse itself during parsing
vmihalko May 13, 2023
0bdf287
parser: fix unused variable warning
vmihalko May 13, 2023
0cf2280
cmake: remove headers from sources
lzaoral Dec 28, 2022
31e5126
cmake: fix compatibility with multiconfig generators
lzaoral Dec 28, 2022
345ac77
cmake: remove redundant static LLVM libraries
lzaoral Dec 30, 2022
e851a4f
cmake: add support for building with MSVC
lzaoral Jan 2, 2023
69f4098
CI: add GitHub Actions workflow for Windows
lzaoral Jan 2, 2023
86f6038
CI: add GitHub Actions workflow for macOS
lzaoral Jan 2, 2023
3067553
CI: add GitHub Actions workflow for Linux
lzaoral Jan 2, 2023
2636f0b
CI: add Dependabot configuration for GitHub Actions
lzaoral Dec 22, 2022
f784ce1
parser: remove unused function
lzaoral Jan 2, 2023
7156506
fixup! CI: add Dependabot configuration for GitHub Actions
vmihalko Oct 8, 2023
703535d
CI: run the CI in various branches
vmihalko Oct 8, 2023
49d0af0
fixup! cmake: add support for building with MSVC
vmihalko Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "monthly"
reviewers:
- "vmihalko"
136 changes: 136 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
name: Linux CI
on:
# TODO: rename to main when we remove the binary blobs from the git history
push:
branches: [ "master", "main", "vmihalko-devel"]
pull_request:
branches: [ "master", "main", "vmihalko-devel"]

jobs:
build:
name: Ubuntu
strategy:
fail-fast: false
matrix:
include:
# Linux with GCC
- {os: 20.04, llvm: '6.0', compiler: gcc}
- {os: 20.04, llvm: 7, compiler: gcc}
- {os: 20.04, llvm: 8, compiler: gcc}
- {os: 20.04, llvm: 9, compiler: gcc}
- {os: 20.04, llvm: 10, compiler: gcc}
- {os: 20.04, llvm: 11, compiler: gcc}
- {os: 20.04, llvm: 12, compiler: gcc}
- {os: 22.04, llvm: 13, compiler: gcc}
- {os: 22.04, llvm: 14, compiler: gcc}
- {os: 22.04, llvm: 14, compiler: gcc, type: Debug}

# Linux with Clang
- {os: 20.04, llvm: '6.0', compiler: clang}
- {os: 20.04, llvm: 7, compiler: clang}
- {os: 20.04, llvm: 8, compiler: clang}
- {os: 20.04, llvm: 9, compiler: clang}
- {os: 20.04, llvm: 10, compiler: clang}
- {os: 20.04, llvm: 11, compiler: clang}
- {os: 20.04, llvm: 12, compiler: clang}
- {os: 22.04, llvm: 13, compiler: clang}
- {os: 22.04, llvm: 14, compiler: clang}
- {os: 22.04, llvm: 14, compiler: clang, type: Debug}

runs-on: ubuntu-${{matrix.os}}
env:
# for colours in ninja
CLICOLOR_FORCE: 1

steps:
- name: Checkout llvm2c
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt install cmake ninja-build clang-${{matrix.llvm}} \
llvm-${{matrix.llvm}}-dev

- name: Set the environment
id: env
run: |
# Set buildtype
if [[ "${{matrix.type}}" != "" ]]; then
echo "BUILD_TYPE=${{matrix.type}}" >> $GITHUB_ENV
else
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV
fi

# TODO: add sanitizer support to llvm2c's CMakeLists.txt

# Build with sanitizers
CFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
CXXFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined"

# Fail on UBSAN
CFLAGS="-fno-sanitize-recover=all $CFLAGS"
CXXFLAGS="-fno-sanitize-recover=all $CXXFLAGS"

# Make UBSAN print whole stack traces
UBSAN_OPTIONS="print_stacktrace=1"

# Fail on any compiler warning
CFLAGS="-Werror $CFLAGS"
CXXFLAGS="-Werror $CXXFLAGS"

# Select compiler and set compiler flags
if [[ "${{matrix.compiler}}" = "clang" ]]; then
# Clang
CC="clang-${{matrix.llvm}}"
CXX="clang++-${{matrix.llvm}}"

# Force coloured output
CFLAGS="-fcolor-diagnostics $CFLAGS"
CXXFLAGS="-fcolor-diagnostics $CXXFLAGS"
else
# GCC
CC="gcc"
CXX="g++"

# Force coloured output
CFLAGS="-fdiagnostics-color $CFLAGS"
CXXFLAGS="-fdiagnostics-color $CXXFLAGS"
fi

# Save the environment
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV
echo "UBSAN_OPTIONS=$UBSAN_OPTIONS" >> $GITHUB_ENV

- name: '[Dynamic LLVM] Configure CMake project'
run: |
cmake -S. \
-B_build \
-GNinja \
-DCMAKE_BUILD_TYPE:STRING="${{matrix.type}}" \
-DLLVM_DIR:PATH="$(llvm-config-${{matrix.llvm}} --cmakedir)"

- name: '[Dynamic LLVM] Build'
run: cmake --build _build

- name: '[Dynamic LLVM] Run tests'
run: cmake --build _build --target check

- name: '[Static LLVM] Re-configure CMake project'
run: |
cmake -S. \
-B_build \
-DLLVM_LINK_DYLIB:BOOL=OFF
cmake --build _build --target clean

- name: '[Static LLVM] Build'
run: cmake --build _build

- name: '[Static LLVM] Run tests'
run: cmake --build _build --target check
90 changes: 90 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
name: macOS CI
on:
# TODO: rename to main when we remove the binary blobs from the git history
push:
branches: [ "master", "main", "vmihalko-devel"]
pull_request:
branches: [ "master", "main", "vmihalko-devel"]

jobs:
build:
name: 'macOS (llvm: ${{matrix.llvm}}, build: ${{matrix.build}})'
strategy:
fail-fast: false
matrix:
llvm: [14]
build: [Debug, RelWithDebInfo]

runs-on: macos-latest
env:
# for colours in ninja
CLICOLOR_FORCE: 1

steps:
- name: Checkout llvm2c
uses: actions/checkout@v3

- name: Install dependencies
run: brew install ninja llvm@${{matrix.llvm}}

- name: Set environment
id: env
run: |
# TODO: add sanitizer support to llvm2c's CMakeLists.txt

# Build with sanitizers
CFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
CXXFLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined"

# Fail on UBSAN
CFLAGS="-fno-sanitize-recover=all $CFLAGS"
CXXFLAGS="-fno-sanitize-recover=all $CXXFLAGS"

# Make UBSAN print whole stack traces
UBSAN_OPTIONS="print_stacktrace=1"

# Fail on any compiler warning
CFLAGS="-Werror $CFLAGS"
CXXFLAGS="-Werror $CXXFLAGS"

# Force coloured output
CFLAGS="-fcolor-diagnostics $CFLAGS"
CXXFLAGS="-fcolor-diagnostics $CXXFLAGS"

# Save the environment
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV
echo "UBSAN_OPTIONS=$UBSAN_OPTIONS" >> $GITHUB_ENV

- name: '[Dynamic LLVM] Configure CMake project'
run: |
LLVM_CONFIG="$(brew --prefix llvm@${{matrix.llvm}})/bin/llvm-config"
cmake -S. \
-B_build \
-GNinja \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build}} \
-DLLVM_DIR:PATH="$("$LLVM_CONFIG" --cmakedir)"

- name: '[Dynamic LLVM] Build'
run: cmake --build _build

- name: '[Dynamic LLVM] Run tests'
run: cmake --build _build --target check

- name: '[Static LLVM] Re-configure CMake project'
run: |
cmake -S. \
-B_build \
-DLLVM_LINK_DYLIB:BOOL=OFF
cmake --build _build --target clean

- name: '[Static LLVM] Build'
run: cmake --build _build

- name: '[Static LLVM] Run tests'
run: cmake --build _build --target check
86 changes: 86 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: Windows CI
on:
# TODO: rename to main when we remove the binary blobs from the git history
push:
branches: [ "master", "main", "vmihalko-devel"]
pull_request:
branches: [ "master", "main", "vmihalko-devel"]

jobs:
build:
name: 'Windows (llvm: ${{matrix.llvm}}, build: ${{matrix.build}})'
strategy:
fail-fast: false
matrix:
llvm: [13]
build: [RelWithDebInfo]

runs-on: windows-latest
steps:
- name: Checkout llvm2c
uses: actions/checkout@v3

- name: Install dependencies
run: |
# Use LLVM build from the authors of the zig language:
# https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows#option-1-use-the-windows-zig-compiler-dev-kit
curl -o llvm.tar.xz "https://ziglang.org/deps/llvm%2bclang%2blld-${{matrix.llvm}}.0.1-x86_64-windows-msvc-release-mt.tar.xz"

# workaround for https://github.com/actions/runner-images/issues/282
$env:Path = "C:\\Program Files\\Git\\usr\\bin;" + $env:Path

# extract twice to deal with dangling symlinks
tar xvf .\llvm.tar.xz
tar xvf .\llvm.tar.xz

- name: Set environment
run: |
# TODO: add sanitizer support to llvm2c's CMakeLists.txt

# Build with sanitizers (TODO: add UBSAN when MSVC supports it)
$CFLAGS = "/fsanitize=address"
$CXXFLAGS = "/fsanitize=address"

# Make UBSAN print whole stack traces
$UBSAN_OPTIONS = "print_stacktrace=1"

# Fail on any compiler warning
$CFLAGS += " /WX"
$CXXFLAGS += " /WX"

# Save the environment
"CFLAGS=$CFLAGS" >> $env:GITHUB_ENV
"CXXFLAGS=$CXXFLAGS" >> $env:GITHUB_ENV
"UBSAN_OPTIONS=$UBSAN_OPTIONS" >> $env:GITHUB_ENV

# TODO: LLVM cannot be build as a DLL on Windows. Uncomment when it is
# possible.
#
#- name: '[Dynamic LLVM] Configure CMake project'
# run: |
# $LLVM_CONFIG = Resolve-Path 'llvm*\bin\llvm-config.exe'
# cmake -S. `
# -B_build `
# -DLLVM_DIR:PATH="$(& "$LLVM_CONFIG" --cmakedir)"
#
#- name: '[Dynamic LLVM] Build'
# run: cmake --build _build --config ${{matrix.build}}
#
#- name: '[Dynamic LLVM] Run tests'
# run: cmake --build _build --target check

- name: '[Static LLVM] Re-configure CMake project'
run: |
$LLVM_CONFIG = Resolve-Path 'llvm*\bin\llvm-config.exe'
cmake -S. `
-B_build `
-DLLVM_LINK_DYLIB:BOOL=OFF `
-DLLVM_DIR:PATH="$(& "$LLVM_CONFIG" --cmakedir)"

- name: '[Static LLVM] Build'
run: cmake --build _build --config ${{matrix.build}}

# FIXME: enable tests on Windows
#- name: '[Static LLVM] Run tests'
# run: cmake --build _build --target check
Loading
Loading