Debian Codegraph @

.github/workflows/build_and_test.yml

raw
1 name: Build and Test
2
3 on:
4 pull_request:
5 types: [opened, reopened, synchronize, ready_for_review, review_requested]
6 branches-ignore:
7 - "gh-pages"
8 push:
9 branches:
10 - "master"
11 - "prepare-release"
12 tags:
13 - v*
14 workflow_dispatch:
15
16 permissions:
17 contents: read
18
19 jobs:
20 check_code_format:
21 name: Check code formatting
22 runs-on: "ubuntu-22.04"
23 # The code currently doesn't pass formatting.
24 # Enable this workflow job once it does, to detect regressions.
25 if: false
26 steps:
27 - uses: actions/checkout@v4
28 - name: Check clang-format (make test-formatting)
29 run: |
30 make test-formatting
31
32 plain_makefile:
33 name: Build and test using plain Makefile
34 runs-on: "ubuntu-22.04"
35 steps:
36 - uses: actions/checkout@v4
37 - name: Add system tools
38 run: |
39 sudo apt-get update && sudo apt-get install libgtest-dev help2man
40 - name: Build (make all)
41 run: |
42 make all
43 - name: Test (make test)
44 run: |
45 make test
46
47 python_module:
48 name: Build and test Python module
49 runs-on: "ubuntu-22.04"
50 strategy:
51 fail-fast: false
52 matrix:
53 # Python 3.6 isn't available on the ubuntu-22.04 GitHub runner
54 # (which is the oldest Ubuntu runner still available)
55 # Python 3.7 is too old for the version of setuptools that we request.
56 # (and we want that setuptools to be able to set certain compiler options correctly)
57 # Python 3.8 is the oldest we can easily support, I think.
58 # Note Python 3.8 and 3.9 are already _past_ end of life: https://devguide.python.org/versions/
59 # 3.8 EOL was 07 Oct 2024
60 # 3.9 EOL was 31 Oct 2025
61 python_version: ["3.8", "3.10", "3.14"]
62 steps:
63 - uses: actions/checkout@v4
64 - uses: actions/setup-python@v5
65 with:
66 python-version: "${{ matrix.python_version }}"
67 - name: Build
68 run: |
69 pip install build
70 python -m build --sdist --wheel
71 - name: Test
72 run: |
73 python -m venv --clear trial &&
74 cd trial &&
75 source bin/activate &&
76 pip install ../dist/jsonnet-*.whl &&
77 python3 ../python/_jsonnet_test.py
78
79 cmake_build:
80 name: Build and test using CMake
81 runs-on: "ubuntu-22.04"
82 steps:
83 - uses: actions/checkout@v4
84 - name: Configure (cmake)
85 run: |
86 cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -B "${{github.workspace}}/build"
87 - name: Build (cmake --build)
88 working-directory: ${{github.workspace}}/build
89 run: |
90 cmake --build .
91 - name: Test (ctest))
92 working-directory: ${{github.workspace}}/build
93 run: |
94 ctest --output-on-failure
95
96 bazel_build:
97 name: Build and test using Bazel
98 runs-on: "ubuntu-22.04"
99 steps:
100 - uses: actions/checkout@v4
101 - name: Build
102 run: |
103 bazelisk build --lockfile_mode=error -c opt //cmd:all
104 - name: Test
105 run: |
106 bazelisk test --lockfile_mode=error //...
107
108 bazel_use_module:
109 name: Build Bazel example
110 runs-on: "ubuntu-22.04"
111 strategy:
112 fail-fast: false
113 matrix:
114 bazel_version: ["7.*", "8.*", "9.*"]
115 steps:
116 - uses: actions/checkout@v4
117 - name: Build
118 env:
119 USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
120 run: |
121 cd examples/bazel
122 bazelisk build --lockfile_mode=off //...
123
124 cmake_example:
125 name: Build CMake example
126 runs-on: "ubuntu-22.04"
127 steps:
128 - uses: actions/checkout@v4
129 - name: Build
130 run: |
131 cd examples/cmake
132 BUILD_DIR="$(mktemp -d)"
133 cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -S . -B "${BUILD_DIR}" && \
134 cmake --build "${BUILD_DIR}" -- -v && \
135 ${BUILD_DIR}/jsonnet_cmake_example