forked from pmem/pmemkv
-
Notifications
You must be signed in to change notification settings - Fork 6
93 lines (83 loc) · 3.51 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
name: pmemkv
on:
push:
pull_request:
release:
types:
- created
env:
REPO: pmemkv
GITHUB_REPO: pmem/pmemkv
CONTAINER_REG: ghcr.io/pmem/pmemkv
HOST_WORKDIR: ${{ github.workspace }}
WORKDIR: utils/docker
TEST_TIMEOUT: 600
IMG_VER: latest
jobs:
linux:
name: pmemkv
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 }}
strategy:
matrix:
CONFIG: ["TYPE=debug OS=fedora OS_VER=32",
"TYPE=debug OS=ubuntu OS_VER=20.10",
"TYPE=debug OS=ubuntu OS_VER=20.04 CHECK_CPP_STYLE=1 COVERAGE=1",
"TYPE=release OS=fedora OS_VER=32",
"TYPE=release OS=ubuntu OS_VER=20.04 PUSH_IMAGE=1",
"TYPE=valgrind OS=ubuntu OS_VER=20.04",
"TYPE=memcheck_drd OS=ubuntu OS_VER=20.04",
"TYPE=building OS=fedora OS_VER=32 PUSH_IMAGE=1",
"TYPE=building OS=ubuntu OS_VER=20.10 PUSH_IMAGE=1 COVERAGE=1 ",
"TYPE=compatibility OS=fedora OS_VER=32",
"TYPE=bindings OS=ubuntu OS_VER=20.04_bindings PUSH_IMAGE=1"]
steps:
- 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 }}
if:
github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/stable-')
strategy:
matrix:
CONFIG: ["TYPE=doc OS=fedora OS_VER=32"]
steps:
- name: Set image version for stable branch
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
- 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