forked from apple/foundationdb
-
Notifications
You must be signed in to change notification settings - Fork 6
238 lines (203 loc) · 8.23 KB
/
build.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
name: Build
on:
push:
branches: ["ow-fork-*"]
tags: ["*-*ow"]
jobs:
calc_ver:
# calculate versions from git tags
runs-on: ubuntu-latest
outputs:
project_ver: ${{steps.vers.outputs.project_ver}}
build_ver: ${{steps.vers.outputs.build_ver}}
full_ver: ${{steps.vers.outputs.full_ver}}
release_flag: ${{steps.vers.outputs.release_flag}}
release_id: ${{ steps.create_release.outputs.id }}
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Calculate versions
id: vers
shell: bash
run: ${{github.workspace}}/build-scripts/for-github/calc-version-from-git.bash
- name: Create Draft Release
if: ${{ steps.vers.outputs.release_flag == 'ON' }}
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.vers.outputs.full_ver }}"
name: "v${{ steps.vers.outputs.full_ver }}"
draft: true
prerelease: false
build:
needs: [calc_ver]
strategy:
matrix:
include:
- run_on: ubuntu-latest
for: linux
prepare: "debian-based"
build_on: linux
parallel: 5
image: foundationdb-build:7.3.0-1.ow.build
owner: owtech
runs-on: ${{ matrix.run_on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set building repo
run: |
echo "use_image=ghcr.io/${{matrix.owner}}/${{matrix.image}}" >> "$GITHUB_ENV"
- name: Build
run: |
mkdir -p ${{github.workspace}}/bld
chmod 777 ${{github.workspace}}/bld
podman run --rm \
--name build \
--mount=type=tmpfs,dst=/tmp \
--mount=type=tmpfs,dst=/var/tmp \
--security-opt label=disable \
--mount=type=bind,src=${{github.workspace}},dst=/home/runner/src,readonly \
--mount=type=bind,src=${{github.workspace}}/bld,dst=/home/runner/bld \
$use_image \
/home/runner/src/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.bash \
${{needs.calc_ver.outputs.project_ver}} \
${{needs.calc_ver.outputs.build_ver}} \
${{needs.calc_ver.outputs.release_flag}} \
${{ matrix.parallel }}
# - name: Minimal tests
# working-directory: ${{github.workspace}}/bld
# shell: bash
# run: ctest --output-on-failure -V
- name: Upload result
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
with:
path: |
${{github.workspace}}/bld/linux/packages/*${{needs.calc_ver.outputs.full_ver}}*
upload-release-files: ${{ needs.calc_ver.outputs.release_flag }}
release-upload-url: ${{ needs.calc_ver.outputs.release_upload_url }}
if-no-files-found: error
test_deploy:
needs: [calc_ver, build]
runs-on: ubuntu-latest
env:
RPM_IMAGE: oraclelinux:8
DEB_IMAGE: debian:10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download the foundationdb distro
uses: actions/download-artifact@v4
with:
path: ${{github.workspace}}/bld/download
- name: Make a normal distro directory from the downloaded artifacts
shell: bash
run: |
ls -Rl ${{github.workspace}}/bld/download
mkdir -p ${{github.workspace}}/bld/linux/packages
mv -v ${{github.workspace}}/bld/download/*/* ${{github.workspace}}/bld/linux/packages/
- name: Run tests
shell: bash
run: ${{github.workspace}}/build-scripts/for-linux/test-deploy.bash ${{ needs.calc_ver.outputs.full_ver }} ${{github.workspace}}/bld/linux/packages $RPM_IMAGE $DEB_IMAGE
release:
needs: [calc_ver, build]
if: ${{ needs.calc_ver.outputs.release_flag == 'ON' }}
runs-on: ubuntu-latest
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.calc_ver.outputs.release_id }}
publish_images:
needs: [calc_ver, build]
if: ${{ needs.calc_ver.outputs.release_flag == 'ON' }}
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: ghcr.io
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download the foundationdb distro
uses: actions/download-artifact@v4
with:
path: ${{github.workspace}}/bld/download
- name: Listing the downloaded artifacts
# This is where you will update the personal access token to GITHUB_TOKEN
run: ls -Rl ${{github.workspace}}/bld/download
- name: Make a normal distro directory from downloaded artifacts
shell: bash
run: |
mkdir -p ${{github.workspace}}/bld/linux/packages
mv -v ${{github.workspace}}/bld/download/*/* ${{github.workspace}}/bld/linux/packages/
- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login $DOCKER_REGISTRY -u $ --password-stdin
- name: Build and push images
shell: bash
run: |
${{github.workspace}}/packaging/docker/build-images-for-owtech.bash \
${{needs.calc_ver.outputs.full_ver}} \
${{github.workspace}}/bld/linux/packages \
ghcr.io/${GITHUB_REPOSITORY_OWNER@L}
tests:
needs: [calc_ver, build]
runs-on: ubuntu-latest
env:
JOSHUA_DB_VER: "6.3.15"
N_OF_TESTS: 500 # to fit in 360 minutes job run limit
JOSHUA_AGENT_URL: "docker.io/1inker"
JOSHUA_AGENT_TAG: "rhel8-20220816"
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y sudo wget crudini git python3 python3-pip
sudo pip3 install wheel setuptools python-dateutil lxml boto3
- name: Install FoundationDb
shell: bash
run: |
mkdir deb
pushd deb
MY_ARCH=`dpkg-architecture -q DEB_BUILD_ARCH`
wget https://github.com/apple/foundationdb/releases/download/${{ env.JOSHUA_DB_VER }}/foundationdb-clients_${{ env.JOSHUA_DB_VER }}-1_${MY_ARCH}.deb https://github.com/apple/foundationdb/releases/download/${{ env.JOSHUA_DB_VER }}/foundationdb-server_${{ env.JOSHUA_DB_VER }}-1_${MY_ARCH}.deb
sudo apt-get install -y ./foundationdb-clients_${{ env.JOSHUA_DB_VER }}-1_${MY_ARCH}.deb ./foundationdb-server_${{ env.JOSHUA_DB_VER }}-1_${MY_ARCH}.deb
popd
sudo systemctl stop foundationdb
MY_IP=`hostname -I | awk '{print $1}'`
sudo sed -i s/127.0.0.1/$MY_IP/ /etc/foundationdb/fdb.cluster
sudo crudini --set /etc/foundationdb/foundationdb.conf fdbserver memory 4GiB
sudo systemctl start foundationdb
pip3 install 'foundationdb==${{ env.JOSHUA_DB_VER }}'
- name: Download the correctness package
uses: actions/download-artifact@v4
id: download_correctness
with:
name: correctness-${{needs.calc_ver.outputs.full_ver}}.tar.gz
- name: 'Echo download path'
run: echo ${{steps.download_correctness.outputs.download-path}}
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{github.workspace}}
- name: Download joshua
shell: bash
run: |
git clone https://github.com/FoundationDB/fdb-joshua.git
- name: run joshua-agent
shell: bash
run: |
podman pull ${{ env.JOSHUA_AGENT_URL }}/joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
podman create --name joshua-agent -v /etc/foundationdb:/etc/foundationdb -it joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
podman start joshua-agent
- name: run tests
shell: bash
working-directory: ${{github.workspace}}/fdb-joshua
run: |
podman ps
python3 -m joshua.joshua start --tarball ${{github.workspace}}/correctness-${{needs.calc_ver.outputs.full_ver}}.tar.gz --max-runs ${{ env.N_OF_TESTS }} && \
python3 -m joshua.joshua tail