forked from petrv7/llvm2c
-
Notifications
You must be signed in to change notification settings - Fork 9
Add GitHub Actions workflows #54
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
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4ecc228
cmake: remove headers from sources
lzaoral ae3ef14
cmake: fix compatibility with multiconfig generators
lzaoral 6983968
cmake: remove redundant static LLVM libraries
lzaoral e87d316
cmake: add support for building with MSVC
lzaoral 82187a9
parser: remove unused function
lzaoral 30a461d
CI: add Dependabot configuration for GitHub Actions
lzaoral 17fc0ef
CI: add GitHub Actions workflow for Linux
lzaoral fff8e14
CI: add GitHub Actions workflow for macOS
lzaoral 404c9a4
CI: add GitHub Actions workflow for Windows
lzaoral File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| 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: | ||
| - "lzaoral" | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| --- | ||
| name: Linux CI | ||
| on: | ||
| # TODO: rename to main when we remove the binary blobs from the git history | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| 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 |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| name: macOS CI | ||
| on: | ||
| # TODO: rename to main when we remove the binary blobs from the git history | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| 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 |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| --- | ||
| name: Windows CI | ||
| on: | ||
| # TODO: rename to main when we remove the binary blobs from the git history | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.