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

Create build-and-test GitHub workflow #1130

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 64 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Test

on:
pull_request:
branches-ignore:
- 'gh-pages'
push:
branches:
- 'master'
tags:
- v*

permissions:
contents: read

jobs:
check_code_format:
name: Check code formatting
runs-on: 'ubuntu-20.04'
# The code currently doesn't pass formatting.
# Enable this workflow job once it does, to detect regressions.
if: false
steps:
- uses: actions/checkout@v4
- name: Check clang-format (make test-formatting)
run: |
make test-formatting

plain_makefile:
name: Build and test using plain Makefile
runs-on: 'ubuntu-20.04'
steps:
- name: Build environment setup
run: |
echo 'Nothing to do.'
echo 'GitHub runner includes tools we need already.'
- uses: actions/checkout@v4
- name: Build (make all)
run: |
make all
- name: Test (make test)
run: |
make test

cmake_build:
name: Build and test using CMake
runs-on: 'ubuntu-20.04'
steps:
- name: Build environment setup
run: |
echo 'Nothing to do.'
echo 'GitHub runner includes tools we need already.'
- uses: actions/checkout@v4
- name: Configure (cmake)
run: |
cmake -B "${{github.workspace}}/build"
- name: Build (cmake --build)
working-directory: ${{github.workspace}}/build
run: |
cmake --build .
- name: Test (ctest))
working-directory: ${{github.workspace}}/build
run: |
ctest --output-on-failure
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ reformat:
clang-format -i -style=file **/*.cpp **/*.h

test-formatting:
test "`clang-format -style=file -output-replacements-xml **/*.cpp **/*.h | grep -c "<replacement "`" == 0
clang-format -Werror --dry-run -style=file **/*.cpp **/*.h

MAKEDEPEND_SRCS = \
cmd/jsonnet.cpp \
Expand Down