Skip to content

Commit 88c0b3f

Browse files
authored
ci: Add tasks for building ystdlib-cpp and a GitHub workflow to validate build success. (#16)
1 parent 9cc7027 commit 88c0b3f

File tree

5 files changed

+92
-1
lines changed

5 files changed

+92
-1
lines changed

.github/workflows/code-linting-checks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ jobs:
2020
lint-check:
2121
strategy:
2222
matrix:
23-
os: ["macos-latest", "ubuntu-latest"]
23+
os:
24+
- "macos-latest"
25+
- "ubuntu-latest"
2426
runs-on: "${{matrix.os}}"
2527
steps:
2628
- uses: "actions/checkout@v4"

.github/workflows/unit-tests.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "unit-tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
schedule:
7+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
8+
- cron: "15 0 * * *"
9+
workflow_dispatch:
10+
11+
permissions: {}
12+
13+
concurrency:
14+
group: "${{github.workflow}}-${{github.ref}}"
15+
16+
# Cancel in-progress jobs for efficiency
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build-ystdlib-cpp:
21+
strategy:
22+
matrix:
23+
os:
24+
- "macos-latest"
25+
- "ubuntu-20.04"
26+
- "ubuntu-22.04"
27+
- "ubuntu-24.04"
28+
runs-on: "${{matrix.os}}"
29+
steps:
30+
- uses: "actions/checkout@v4"
31+
with:
32+
submodules: "recursive"
33+
34+
- uses: "actions/setup-python@v5"
35+
with:
36+
python-version: "3.11"
37+
38+
- name: "Install task"
39+
shell: "bash"
40+
run: "npm install -g @go-task/cli"
41+
42+
- if: "matrix.os == 'macos-latest'"
43+
name: "Install coreutils (for md5sum)"
44+
run: "brew install coreutils"
45+
46+
- name: "Log tool versions"
47+
run: |-
48+
md5sum --version
49+
python --version
50+
tar --version
51+
task --version
52+
53+
# TODO: Change the task to run all unittests once any unittest is added. Until then we check
54+
# that building the project succeeds.
55+
- run: "task build:target"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ Initialize and update submodules:
1515
git submodule update --init --recursive
1616
```
1717

18+
# Building
19+
To build all targets in `ystdlib-cpp`:
20+
```shell
21+
task build:target
22+
```
23+
1824
## Linting
1925
Before submitting a pull request, ensure you’ve run the linting commands below and have fixed all
2026
violations and suppressed all warnings.

taskfile.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: "3"
22

33
includes:
4+
build: "./taskfiles/build.yaml"
45
lint: "./taskfiles/lint.yaml"
56
utils: "tools/yscope-dev-utils/taskfiles/utils.yml"
67

taskfiles/build.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: "3"
2+
3+
tasks:
4+
target:
5+
desc: "Builds ystdlib-cpp."
6+
vars:
7+
TARGETS:
8+
ref: "default (list \"all\") .TARGETS"
9+
deps:
10+
- ":config-cmake-project"
11+
cmds:
12+
- >-
13+
cmake
14+
--build "{{.G_BUILD_DIR}}"
15+
--parallel {{numCPU}}
16+
--target {{range .TARGETS}}{{.}} {{end}}
17+
18+
clean:
19+
desc: "Removes all built artifacts."
20+
deps:
21+
- ":config-cmake-project"
22+
cmds:
23+
- >-
24+
cmake
25+
--build "{{.G_BUILD_DIR}}"
26+
--parallel {{numCPU}}
27+
--target clean

0 commit comments

Comments
 (0)