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

ci: Add a bazel test step to the CI. #10

Merged
merged 4 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
48 changes: 47 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
name: CI
on: [push, pull_request]

on:
push:
tags:
- v*
branches:
- main
pull_request:
merge_group:

# none-all, which doesn't exist, but
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow
# implies that the token still gets created. Elsewhere we learn that any
# permission not mentioned here gets turned to `none`.
permissions:
actions: none

jobs:
test:
strategy:
Expand Down Expand Up @@ -29,3 +45,33 @@ jobs:
run: scons distcheck
env:
CC: ${{ matrix.compiler }}

bazel_test:
runs-on: ubuntu-latest
permissions:
# publish-unit-test-result-action
# writes a comment to the PR
pull-requests: write
# and writes to the checks API
checks: write
steps:
- uses: actions/checkout@v4
- name: mount bazel cache
uses: actions/cache@v4
with:
path: "~/.cache/bazel"
key: bazel
- name: install dependencies
run: |
sudo apt-get install -y \
dejagnu
- run: bazel test --test_output=errors //...
- name: copy test results into workspace
if: always()
run: cp -Lpr $(bazel info bazel-testlogs)/ test-results
- name: publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-results/**/test.xml
5 changes: 5 additions & 0 deletions testsuite/dejagnu.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def _runtest(tool, srcdir):
DEJAGNU_TEST_RUNNER_TEMPLATE = """
set -o errexit

if ! [ -x /bin/runtest ]; then
echo "/bin/runtest not found, install dejagnu" | tee -a $TEST_INFRASTRUCTURE_FAILURE_FILE
exit 127
fi

cleanup () {{
mv $TEST_UNDECLARED_OUTPUTS_DIR/{tool}.xml $XML_OUTPUT_FILE
}}
Expand Down
Loading