Skip to content

Commit 1b503cc

Browse files
author
ramon.valles
committed
Add CI workflow for automated build and testing
1 parent 0c5cccb commit 1b503cc

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build-test:
18+
name: Build + Test
19+
runs-on: ubuntu-22.04
20+
env:
21+
CARGO_TERM_COLOR: always
22+
CMAKE_BUILD_PARALLEL_LEVEL: 2
23+
steps:
24+
- name: Checkout (with submodules)
25+
uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
28+
fetch-depth: 0
29+
30+
- name: Show selected dependency revisions
31+
shell: bash
32+
run: |
33+
set -euo pipefail
34+
git submodule status --recursive
35+
echo
36+
echo "tempoch: $(git -C tempoch rev-parse HEAD) ($(git -C tempoch describe --tags --always 2>/dev/null || true))"
37+
echo "tempoch-ffi: $(git -C tempoch/tempoch-ffi rev-parse HEAD) ($(git -C tempoch/tempoch-ffi describe --tags --always 2>/dev/null || true))"
38+
39+
- name: Install system dependencies
40+
shell: bash
41+
run: |
42+
set -euo pipefail
43+
sudo apt-get update
44+
sudo apt-get install -y --no-install-recommends \
45+
build-essential \
46+
cmake \
47+
ninja-build \
48+
pkg-config
49+
50+
- name: Set up Rust (stable)
51+
uses: actions-rust-lang/setup-rust-toolchain@v1
52+
with:
53+
toolchain: stable
54+
55+
- name: Cache cargo + build artifacts
56+
uses: actions/cache@v4
57+
with:
58+
path: |
59+
~/.cargo/registry
60+
~/.cargo/git
61+
tempoch/target
62+
tempoch/tempoch-ffi/target
63+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
64+
restore-keys: |
65+
${{ runner.os }}-cargo-
66+
67+
- name: Validate required submodules exist
68+
shell: bash
69+
run: |
70+
set -euo pipefail
71+
test -f tempoch/Cargo.toml
72+
test -f tempoch/tempoch-ffi/Cargo.toml
73+
74+
- name: Configure (CMake)
75+
shell: bash
76+
run: |
77+
set -euo pipefail
78+
cmake -S . -B build -G Ninja
79+
80+
- name: Build
81+
shell: bash
82+
run: |
83+
set -euo pipefail
84+
cmake --build build --target test_tempoch
85+
86+
- name: Test (ctest)
87+
shell: bash
88+
run: |
89+
set -euo pipefail
90+
ctest --test-dir build --output-on-failure

0 commit comments

Comments
 (0)