This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
193 lines (169 loc) · 6.96 KB
/
gha.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: CPP
# It runs default OSes for each PR, push event or a new tag,
# checks basic builds with various compilers and executes all sets of tests.
on:
push:
pull_request:
release:
types:
- created
env:
REPO: libpmemobj-cpp
GITHUB_REPO: pmem/libpmemobj-cpp
CONTAINER_REG: ghcr.io/pmem/libpmemobj-cpp
HOST_WORKDIR: ${{ github.workspace }}
TEST_TIMEOUT: 800
IMG_VER: latest
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
env:
# use org's Private Access Token to log in to GitHub Container Registry
CONTAINER_REG_USER: ${{ secrets.GH_CR_USER }}
CONTAINER_REG_PASS: ${{ secrets.GH_CR_PAT }}
FORCE_IMAGE_ACTION: ${{ secrets.FORCE_IMAGE_ACTION }}
WORKDIR: utils/docker
strategy:
matrix:
CONFIG: ["TYPE=debug OS=fedora OS_VER=35 PUSH_IMAGE=1",
"TYPE=debug OS=ubuntu OS_VER=20.04 PUSH_IMAGE=1 CHECK_CPP_STYLE=1",
"TYPE=debug OS=ubuntu OS_VER=20.04 COVERAGE=1",
"TYPE=release OS=fedora OS_VER=35",
"TYPE=release OS=ubuntu OS_VER=20.04",
"TYPE=valgrind OS=ubuntu OS_VER=20.04",
"TYPE=memcheck_drd OS=ubuntu OS_VER=20.04",
"TYPE=package OS=fedora OS_VER=35",
"TYPE=package OS=ubuntu OS_VER=20.04"]
steps:
- name: Get release version
if: github.event_name == 'release'
id: get_release_version
run: echo ::set-output name=VERSION::$(echo ${{ github.event.release.tag_name }} | awk -F '[.-]' '/^[0-9]+.[0-9]+[.0-9]*(-rc[0-9]+)?$/ {print $1 "." $2}')
- name: Set image version and force image action for release
if: github.event_name == 'release' && steps.get_release_version.outputs.VERSION != ''
run: |
echo "IMG_VER=${{ steps.get_release_version.outputs.VERSION }}" >> $GITHUB_ENV
echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV
- name: Set image version and force image action for stable branch
# we want to set IMG_VER to e.g. '1.x' for stable branches and PRs against them
# for PRs we have to use 'base_ref' - this is the target branch (and we have to check that instead)
if:
startsWith(github.ref, 'refs/heads/stable-') || startsWith(github.base_ref, 'stable-')
# we now know we're on (or against) stable branches, so we just need to pick the version (e.g. the mentioned '1.x')
run: |
IMG_VER=$(echo ${GITHUB_BASE_REF} | cut -d - -f 2)
[ -z "${IMG_VER}" ] \
&& echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV \
|| echo "IMG_VER=${IMG_VER}" >> $GITHUB_ENV
echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV
- name: Clone the git repo
uses: actions/checkout@v2
with:
fetch-depth: 0
# "pull" or "rebuild" can be passed to a secret FORCE_IMAGE_ACTION to override default action
- name: Pull the image or rebuild and push it
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh $FORCE_IMAGE_ACTION
- name: Run the build
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
doc:
name: build and publish docs
runs-on: ubuntu-latest
needs: linux
env:
DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
DOC_UPDATE_BOT_NAME: ${{ secrets.DOC_UPDATE_BOT_NAME }}
DOC_REPO_OWNER: ${{ secrets.DOC_REPO_OWNER }}
WORKDIR: utils/docker
if:
github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/stable-')
strategy:
matrix:
CONFIG: ["TYPE=doc OS=fedora OS_VER=35"]
steps:
- name: Set image version for stable branch
# doc update happens only on stable branch (not on PR), so we check only for heads ref
if: startsWith(github.ref, 'refs/heads/stable-')
run: |
echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV
- name: Clone the git repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Pull the image
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh pull
- name: Run the build
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
windows:
name: Windows
runs-on: windows-2019
env:
platform: x64
VCPKG_DEFAULT_TRIPLET: x64-windows
GENERATOR: "Visual Studio 16 2019"
ARCH: "x64"
PMDK_VERSION: "1.9"
CMAKE_TOOLCHAIN_FILE: "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
CMAKE_INSTALL_PREFIX: "C:\\install\\libpmemobj-cpp"
strategy:
matrix:
BUILD_TYPE: [Debug, Release]
CXX_STANDARD: [14]
include:
- BUILD_TYPE: RelWithDebInfo
CXX_STANDARD: 17
steps:
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
with:
msbuild-architecture: ${env:ARCH}
- name: Cache vcpkg packages
uses: actions/cache@v1
id: cache-vcpkg-packages
with:
path: C:/vcpkg/packages
key: vcpkg-packages-45e5a67
- name: Cache vcpkg installed
uses: actions/cache@v1
id: cache-vcpkg-installed
with:
path: C:/vcpkg/installed
key: vcpkg-installed-45e5a67
- name: Clone the git repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install PMDK
run: |
vcpkg install pmdk:x64-windows
vcpkg install sfml:x64-windows
vcpkg install tbb:x64-windows
vcpkg update
vcpkg upgrade pmdk:x64-windows --no-dry-run
- name: vcpkg integrate install
run: vcpkg integrate install
- name: Configure
run: cmake . -Bbuild
-G "${env:GENERATOR}"
-A "${env:ARCH}"
-DCMAKE_BUILD_TYPE="${{ matrix.BUILD_TYPE }}"
-DCMAKE_TOOLCHAIN_FILE="${env:CMAKE_TOOLCHAIN_FILE}"
-DCMAKE_INSTALL_PREFIX="${env:CMAKE_INSTALL_PREFIX}"
-DTESTS_USE_FORCED_PMEM=ON
-DTESTS_USE_VALGRIND=OFF
-DTESTS_TBB=ON
-DDEVELOPER_MODE=ON
-DCXX_STANDARD="${{ matrix.CXX_STANDARD }}"
- name: Build
run: msbuild build/ALL_BUILD.vcxproj /property:Configuration=${{ matrix.BUILD_TYPE }} /verbosity:minimal /m
- name: Tests
working-directory: build
run: ctest -C ${{ matrix.BUILD_TYPE }} --output-on-failure --timeout "${env:TEST_TIMEOUT}"
- name: Install
working-directory: build
run: msbuild INSTALL.vcxproj /verbosity:minimal /m
- name: Examples
working-directory: examples/map_cli
run: |
cmake . -G "${env:GENERATOR}" -A "${env:ARCH}" -DCMAKE_TOOLCHAIN_FILE="${env:CMAKE_TOOLCHAIN_FILE}" -DCMAKE_PREFIX_PATH="${env:CMAKE_INSTALL_PREFIX}"
msbuild ALL_BUILD.vcxproj /verbosity:minimal /m