Skip to content

Commit 3d658d8

Browse files
committed
ci: add workflows for testing and cutting releases
1 parent 423ebc5 commit 3d658d8

7 files changed

Lines changed: 170 additions & 1 deletion

File tree

.github/workflows/build-test.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
runner:
5+
description: "The runner to use"
6+
required: true
7+
default: "ubuntu-22.04"
8+
type: string
9+
triplet:
10+
description: "The triplet to use"
11+
required: true
12+
default: "x64-linux"
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
_VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg
21+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
22+
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache
23+
VCPKG_FEATURE_FLAGS: "dependencygraph"
24+
25+
jobs:
26+
build:
27+
runs-on: ${{ inputs.runner }}
28+
steps:
29+
- name: Check out repository code
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: "true"
33+
34+
- uses: actions/github-script@v6
35+
with:
36+
script: |
37+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
38+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
39+
40+
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
41+
run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache
42+
shell: bash
43+
44+
- uses: lukka/get-cmake@latest
45+
with:
46+
cmakeVersion: "3.29.0"
47+
48+
- name: Restore vcpkg
49+
uses: actions/cache@v3
50+
with:
51+
path: |
52+
${{ env._VCPKG_ }}
53+
!${{ env._VCPKG_ }}/buildtrees
54+
!${{ env._VCPKG_ }}/packages
55+
!${{ env._VCPKG_ }}/downloads
56+
!${{ env._VCPKG_ }}/installed
57+
key: |
58+
${{ inputs.triplet }}-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}}
59+
60+
- name: Configure
61+
env:
62+
CMAKE_VERBOSE_MAKEFILE: 1
63+
VCPKG_DEBUG: 1
64+
run: |
65+
echo "Configuring for triplet ${{ inputs.triplet }}"
66+
TRIPLET=${{ inputs.triplet }} make configure
67+
68+
- name: Build
69+
run: NPROC=1 make build
70+
71+
- uses: actions/upload-artifact@v4
72+
with:
73+
name: build-${{ inputs.triplet }}-${{ github.sha }}
74+
path: build
75+
retention-days: 1
76+
77+
test:
78+
needs: [build]
79+
runs-on: ${{ inputs.runner }}
80+
steps:
81+
- name: Check out repository code
82+
uses: actions/checkout@v4
83+
with:
84+
submodules: "true"
85+
86+
- uses: actions/github-script@v6
87+
with:
88+
script: |
89+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
90+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
91+
92+
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
93+
run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache
94+
shell: bash
95+
96+
- uses: lukka/get-cmake@latest
97+
with:
98+
cmakeVersion: "3.29.0"
99+
100+
- uses: actions/download-artifact@v4
101+
with:
102+
name: build-${{ inputs.triplet }}-${{ github.sha }}
103+
path: build
104+
105+
- name: Run tests
106+
run: make test
107+
shell: bash

.github/workflows/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-test:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
build:
21+
[
22+
{ runner: "ubuntu-22.04", triplet: "x64-linux" },
23+
]
24+
uses: ./.github/workflows/build-test.yml
25+
with:
26+
runner: ${{ matrix.build.runner }}
27+
triplet: ${{ matrix.build.triplet }}
28+
secrets: inherit
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
name: release-please
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
token: ${{ secrets.RELEASE_PLEASE_AT }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.15.5"
3+
}

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.23.5)
22

3-
project(synapse VERSION 0.0.1)
3+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" SYNAPSE_CPP_VERSION)
4+
string(STRIP "${SYNAPSE_CPP_VERSION}" SYNAPSE_CPP_VERSION)
5+
project(synapse VERSION ${SYNAPSE_CPP_VERSION})
46

57
set(CMAKE_CXX_STANDARD 17)
68
set(CMAKE_CXX_STANDARD_REQUIRED ON)

release-please-config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "simple"
5+
}
6+
},
7+
"bootstrap-sha": "e255ba2a354554be7b59ad7711aef9695cd34a92",
8+
"always-update": true,
9+
"bump-minor-pre-major": true
10+
}

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

0 commit comments

Comments
 (0)