Skip to content

Commit 28c362d

Browse files
committed
XDB-494 extract tests job into reusable workflow to eliminate duplication
1 parent 2832a0d commit 28c362d

3 files changed

Lines changed: 104 additions & 147 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -184,76 +184,8 @@ jobs:
184184
185185
tests:
186186
needs: [calc_ver, build]
187-
runs-on: ubuntu-latest
188-
env:
189-
JOSHUA_DB_VER: "7.1.57"
190-
N_OF_TESTS: 500 # to fit in 360 minutes job run limit
191-
JOSHUA_AGENT_URL: "docker.io/marksh2010"
192-
JOSHUA_AGENT_TAG: "rockylinux9.6-20260309"
193-
# parameter that controls the maximum lifetime of the Joshua agent (in seconds).
194-
AGENT_TIMEOUT: 18000
195-
196-
steps:
197-
- name: Checkout
198-
uses: actions/checkout@v4
199-
with:
200-
path: ${{github.workspace}}/src
201-
202-
- name: Install dependencies
203-
shell: bash
204-
run: |
205-
sudo apt-get update
206-
sudo apt-get install -y sudo wget crudini git python3 python3-pip
207-
sudo pip3 install wheel setuptools python-dateutil lxml boto3
208-
209-
- name: Install FoundationDb
210-
shell: bash
211-
run: |
212-
mkdir deb
213-
pushd deb
214-
MY_ARCH=`dpkg-architecture -q DEB_BUILD_ARCH`
215-
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
216-
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
217-
popd
218-
sudo systemctl stop foundationdb
219-
MY_IP=`hostname -I | awk '{print $1}'`
220-
sudo sed -i s/127.0.0.1/$MY_IP/ /etc/foundationdb/fdb.cluster
221-
sudo crudini --set /etc/foundationdb/foundationdb.conf fdbserver memory 4GiB
222-
sudo systemctl start foundationdb
223-
pip3 install 'foundationdb==${{ env.JOSHUA_DB_VER }}'
224-
225-
- name: Download the correctness package
226-
uses: actions/download-artifact@v4
227-
id: download_correctness
228-
with:
229-
name: correctness-${{needs.calc_ver.outputs.full_ver}}.tar.gz
230-
231-
- name: 'Echo download path'
232-
run: echo ${{steps.download_correctness.outputs.download-path}}
233-
234-
- name: Display structure of downloaded files
235-
run: ls -R
236-
working-directory: ${{github.workspace}}
237-
238-
- name: Download joshua
239-
shell: bash
240-
run: |
241-
git clone https://github.com/FoundationDB/fdb-joshua.git
242-
243-
- name: run joshua-agent
244-
shell: bash
245-
run: |
246-
podman pull ${{ env.JOSHUA_AGENT_URL }}/joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
247-
for i in 1 2 3 4; do
248-
podman run -d \
249-
-v /etc/foundationdb:/etc/foundationdb \
250-
-e AGENT_TIMEOUT=${{ env.AGENT_TIMEOUT }} \
251-
joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
252-
done
253-
254-
- name: run tests
255-
shell: bash
256-
working-directory: ${{github.workspace}}/fdb-joshua
257-
run: |
258-
podman ps
259-
${{github.workspace}}/src/build-scripts/for-linux/test-joshua.bash ${{github.workspace}}/correctness-${{needs.calc_ver.outputs.full_ver}}.tar.gz ${{env.N_OF_TESTS}}
187+
uses: ./.github/workflows/run-tests.yml
188+
with:
189+
full_ver: ${{needs.calc_ver.outputs.full_ver}}
190+
build_run_id: ${{ github.run_id }}
191+
secrets: inherit

.github/workflows/run-tests.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Run Tests (reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
full_ver:
7+
description: 'Version of the build to test (e.g. 7.4.0-3.1.ow)'
8+
required: true
9+
type: string
10+
build_run_id:
11+
description: 'Run ID to download the correctness package from'
12+
required: true
13+
type: string
14+
secrets:
15+
GITHUB_TOKEN:
16+
required: true
17+
18+
jobs:
19+
tests:
20+
runs-on: ubuntu-latest
21+
env:
22+
JOSHUA_DB_VER: "7.1.57"
23+
N_OF_TESTS: 500 # to fit in 360 minutes job run limit
24+
JOSHUA_AGENT_URL: "docker.io/marksh2010"
25+
JOSHUA_AGENT_TAG: "rockylinux9.6-20260309"
26+
# parameter that controls the maximum lifetime of the Joshua agent (in seconds).
27+
AGENT_TIMEOUT: 18000
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
path: ${{github.workspace}}/src
34+
35+
- name: Install dependencies
36+
shell: bash
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y sudo wget crudini git python3 python3-pip
40+
sudo pip3 install wheel setuptools python-dateutil lxml boto3
41+
42+
- name: Install FoundationDb
43+
shell: bash
44+
run: |
45+
mkdir deb
46+
pushd deb
47+
MY_ARCH=`dpkg-architecture -q DEB_BUILD_ARCH`
48+
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
49+
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
50+
popd
51+
sudo systemctl stop foundationdb
52+
MY_IP=`hostname -I | awk '{print $1}'`
53+
sudo sed -i s/127.0.0.1/$MY_IP/ /etc/foundationdb/fdb.cluster
54+
sudo crudini --set /etc/foundationdb/foundationdb.conf fdbserver memory 4GiB
55+
sudo systemctl start foundationdb
56+
pip3 install 'foundationdb==${{ env.JOSHUA_DB_VER }}'
57+
58+
- name: Download the correctness package
59+
uses: actions/download-artifact@v4
60+
id: download_correctness
61+
with:
62+
name: correctness-${{ inputs.full_ver }}.tar.gz
63+
run-id: ${{ inputs.build_run_id }}
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Echo download path
67+
run: echo ${{steps.download_correctness.outputs.download-path}}
68+
69+
- name: Display structure of downloaded files
70+
run: ls -R
71+
working-directory: ${{github.workspace}}
72+
73+
- name: Download joshua
74+
shell: bash
75+
run: |
76+
git clone https://github.com/FoundationDB/fdb-joshua.git
77+
78+
- name: run joshua-agent
79+
shell: bash
80+
run: |
81+
podman pull ${{ env.JOSHUA_AGENT_URL }}/joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
82+
for i in 1 2 3 4; do
83+
podman run -d \
84+
-v /etc/foundationdb:/etc/foundationdb \
85+
-e AGENT_TIMEOUT=${{ env.AGENT_TIMEOUT }} \
86+
joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
87+
done
88+
89+
- name: run tests
90+
shell: bash
91+
working-directory: ${{github.workspace}}/fdb-joshua
92+
run: |
93+
podman ps
94+
${{github.workspace}}/src/build-scripts/for-linux/test-joshua.bash ${{github.workspace}}/correctness-${{ inputs.full_ver }}.tar.gz ${{env.N_OF_TESTS}}

.github/workflows/tests-only.yml

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,8 @@ on:
1212

1313
jobs:
1414
tests:
15-
runs-on: ubuntu-latest
16-
env:
17-
JOSHUA_DB_VER: "7.1.57"
18-
N_OF_TESTS: 500
19-
JOSHUA_AGENT_URL: "docker.io/marksh2010"
20-
JOSHUA_AGENT_TAG: "rockylinux9.6-20260309"
21-
AGENT_TIMEOUT: 18000
22-
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
with:
27-
path: ${{github.workspace}}/src
28-
29-
- name: Install dependencies
30-
shell: bash
31-
run: |
32-
sudo apt-get update
33-
sudo apt-get install -y sudo wget crudini git python3 python3-pip
34-
sudo pip3 install wheel setuptools python-dateutil lxml boto3
35-
36-
- name: Install FoundationDb
37-
shell: bash
38-
run: |
39-
mkdir deb
40-
pushd deb
41-
MY_ARCH=`dpkg-architecture -q DEB_BUILD_ARCH`
42-
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
43-
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
44-
popd
45-
sudo systemctl stop foundationdb
46-
MY_IP=`hostname -I | awk '{print $1}'`
47-
sudo sed -i s/127.0.0.1/$MY_IP/ /etc/foundationdb/fdb.cluster
48-
sudo crudini --set /etc/foundationdb/foundationdb.conf fdbserver memory 4GiB
49-
sudo systemctl start foundationdb
50-
pip3 install 'foundationdb==${{ env.JOSHUA_DB_VER }}'
51-
52-
- name: Download the correctness package
53-
uses: actions/download-artifact@v4
54-
id: download_correctness
55-
with:
56-
name: correctness-${{ github.event.inputs.full_ver }}.tar.gz
57-
run-id: ${{ github.event.inputs.build_run_id }}
58-
github-token: ${{ secrets.GITHUB_TOKEN }}
59-
60-
- name: Echo download path
61-
run: echo ${{steps.download_correctness.outputs.download-path}}
62-
63-
- name: Display structure of downloaded files
64-
run: ls -R
65-
working-directory: ${{github.workspace}}
66-
67-
- name: Download joshua
68-
shell: bash
69-
run: |
70-
git clone https://github.com/FoundationDB/fdb-joshua.git
71-
72-
- name: run joshua-agent
73-
shell: bash
74-
run: |
75-
podman pull ${{ env.JOSHUA_AGENT_URL }}/joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
76-
for i in 1 2 3 4; do
77-
podman run -d \
78-
-v /etc/foundationdb:/etc/foundationdb \
79-
-e AGENT_TIMEOUT=${{ env.AGENT_TIMEOUT }} \
80-
joshua-agent:${{ env.JOSHUA_AGENT_TAG }}
81-
done
82-
83-
- name: run tests
84-
shell: bash
85-
working-directory: ${{github.workspace}}/fdb-joshua
86-
run: |
87-
podman ps
88-
${{github.workspace}}/src/build-scripts/for-linux/test-joshua.bash ${{github.workspace}}/correctness-${{ github.event.inputs.full_ver }}.tar.gz ${{env.N_OF_TESTS}}
15+
uses: ./.github/workflows/run-tests.yml
16+
with:
17+
full_ver: ${{ github.event.inputs.full_ver }}
18+
build_run_id: ${{ github.event.inputs.build_run_id }}
19+
secrets: inherit

0 commit comments

Comments
 (0)