Skip to content

Commit f44ab6f

Browse files
authored
ci: add testing and release cutting workflows (#19)
* ci: add workflows for testing and cutting releases * chore: fix vcpkg root * chore: update scipp * chore: update scipp * chore: release-please * chore: consolidate build & test in ci * chore: consolidate ci workflows
1 parent 423ebc5 commit f44ab6f

File tree

9 files changed

+125
-2
lines changed

9 files changed

+125
-2
lines changed

.github/workflows/main.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
_VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg
14+
VCPKG_ROOT: ${{ github.workspace }}/external/microsoft/vcpkg
15+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
16+
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache
17+
VCPKG_FEATURE_FLAGS: "dependencygraph"
18+
19+
jobs:
20+
build-test:
21+
runs-on: ubuntu-22.04
22+
env:
23+
TRIPLET: x64-linux
24+
steps:
25+
- name: Check out repository code
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: "true"
29+
30+
- uses: actions/github-script@v6
31+
with:
32+
script: |
33+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
34+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
35+
36+
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
37+
run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache
38+
shell: bash
39+
40+
- uses: lukka/get-cmake@latest
41+
with:
42+
cmakeVersion: "3.29.0"
43+
44+
- name: Restore vcpkg
45+
uses: actions/cache@v3
46+
with:
47+
path: |
48+
${{ env._VCPKG_ }}
49+
!${{ env._VCPKG_ }}/buildtrees
50+
!${{ env._VCPKG_ }}/packages
51+
!${{ env._VCPKG_ }}/downloads
52+
!${{ env._VCPKG_ }}/installed
53+
key: |
54+
${{ env.TRIPLET }}-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}}
55+
56+
- name: Configure
57+
env:
58+
CMAKE_VERBOSE_MAKEFILE: 1
59+
VCPKG_DEBUG: 1
60+
run: |
61+
echo "Configuring for triplet ${{ env.TRIPLET }}"
62+
TRIPLET=${{ env.TRIPLET }} make configure
63+
64+
- name: Upload vcpkg buildtrees
65+
if: always()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: vcpkg-buildtrees-${{ env.TRIPLET }}-${{ github.sha }}
69+
path: external/microsoft/vcpkg/buildtrees/science-scipp
70+
retention-days: 1
71+
72+
- name: Build
73+
run: NPROC=1 make build
74+
75+
- uses: actions/upload-artifact@v4
76+
with:
77+
name: build-${{ env.TRIPLET }}-${{ github.sha }}
78+
path: build
79+
retention-days: 1
80+
81+
- name: Run tests
82+
run: make test
83+
shell: bash
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.1.0"
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)

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
VCPKG_MANIFEST_FEATURES ?= examples\;tests
2+
13
.PHONY: all
24
all: clean configure build
35

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ To build:
1414

1515
```sh
1616
git submodule update --init
17+
18+
# Set up vcpkg -- you can also use a vcpkg elsewhere via VCPKG_ROOT
1719
cd external/microsoft/vcpkg && ./bootstrap-vcpkg.sh && cd -
20+
export VCPKG_ROOT="$(pwd)/external/microsoft/vcpkg}"
21+
1822
make all
1923

2024
# or

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)