Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aa4c2fa
chore(gh-workflows): add regression tests to release job
kostasrim Aug 7, 2023
8369e3e
WIP
kostasrim Aug 8, 2023
d827047
fix: migrate reusable workflow as action
kostasrim Aug 9, 2023
3aa956e
fix: regression test action
kostasrim Aug 9, 2023
41e17e5
fix: broken action
kostasrim Aug 9, 2023
d31a423
fix: prefix token to properly use it
kostasrim Aug 9, 2023
a0decab
fix: add missing composite
kostasrim Aug 9, 2023
d4375a7
fix: use expression properly
kostasrim Aug 9, 2023
3a7dba8
fix: update release workflow
kostasrim Aug 9, 2023
64c086f
fix: action check && release
kostasrim Aug 9, 2023
f41aeec
to be dropped
kostasrim Aug 9, 2023
0173dc0
WIP
kostasrim Aug 9, 2023
be56c36
try regression on release
kostasrim Aug 9, 2023
dce6c0a
add trigger
kostasrim Aug 9, 2023
cd2dd22
try
kostasrim Aug 9, 2023
0a0f223
try proper tagging
kostasrim Aug 9, 2023
3d983c6
add explicit tag
kostasrim Aug 9, 2023
928be49
add pip install
kostasrim Aug 9, 2023
29e9f70
call action properly
kostasrim Aug 9, 2023
246576b
properly name dfly executable on release
kostasrim Aug 9, 2023
23a0b57
try to run composite action in docker arm
kostasrim Aug 9, 2023
db9754b
revert regression tests for docker arm release
kostasrim Aug 10, 2023
65f5cae
revert CI to original state
kostasrim Aug 10, 2023
cdebaf2
remove extra spaces
kostasrim Aug 10, 2023
f256e6c
add parameter for build folder name in regression action
kostasrim Aug 16, 2023
6be689a
Merge branch 'main' into update_release_workflow
kostasrim Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/actions/regression-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Regression Tests
description: "Run regression tests"

inputs:
dfly-executable:
required: true
type: string
gspace-secret:
required: true
type: string
run-only-on-ubuntu-latest:
# 'true' or 'false' cause boolean
# is not supported in composite actions
required: true
type: string
build-folder-name:
required: true
type: string


runs:
using: "composite"
# bring back timeouts once composite actions start supporting them
# timeout-minutes: 20
steps:
- name: Run PyTests
shell: bash
run: |
ls -l ${GITHUB_WORKSPACE}/
cd ${GITHUB_WORKSPACE}/tests
echo "Current commit is ${{github.sha}}"
pip install -r dragonfly/requirements.txt
# used by PyTests
export DRAGONFLY_PATH="${GITHUB_WORKSPACE}/${{inputs.build-folder-name}}/${{inputs.dfly-executable}}"
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 # to crash on errors

pytest --json-report --json-report-file=report.json -svr dragonfly --ignore=dragonfly/replication_test.py



- name: Run PyTests replication test
if: ${{ inputs.run-only-on-ubuntu-latest == 'false' || matrix.runner == 'ubuntu-latest' }}
shell: bash
run: |
echo "Running PyTests replication test with flag: ${{ inputs.run-only-on-ubuntu-latest }}"
cd ${GITHUB_WORKSPACE}/tests
# used by PyTests
export DRAGONFLY_PATH="${GITHUB_WORKSPACE}/${{inputs.build-folder-name}}/${{inputs.dfly-executable}}"

pytest --json-report --json-report-file=rep1_report.json -sv dragonfly/replication_test.py --df alsologtostderr --df enable_multi_shard_sync=true
pytest --json-report --json-report-file=rep2_report.json -sv dragonfly/replication_test.py --df alsologtostderr --df enable_multi_shard_sync=false



- name: Send notification on failure
if: failure()
shell: bash
run: |
get_failed_tests() {
local report_file=$1
echo $(jq -r '.tests[] | select(.outcome == "failed") | .nodeid' "$report_file")
}
cd ${GITHUB_WORKSPACE}/tests
failed_tests=""
# The order in of if is important, and expected to be the oposite order of the pytest run.
# As github runner will not run the next step if the pytest failed, we start from the last
# report file and if exist we get the failed test from the pytest run, if there are any.
if [ -f rep2_report.json ]; then
failed_tests=$(get_failed_tests rep2_report.json)
elif [ -f rep1_report.json ]; then
failed_tests=$(get_failed_tests rep1_report.json)
elif [ -f report.json ]; then
failed_tests=$(get_failed_tests report.json)
fi

job_link="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
message="Regression tests failed.\\n The commit is: ${{github.sha}}.\\n $failed_tests \\n Job Link: ${job_link}\\n"

curl -s \
-X POST \
-H 'Content-Type: application/json' \
'${{ inputs.gspace-secret }}' \
-d '{"text": "'"${message}"'"}'
66 changes: 8 additions & 58 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ on:
- cron: '0 0/3 * * *'
workflow_dispatch:




jobs:
build-n-test:
build:
strategy:
matrix:
# Test of these containers
Expand Down Expand Up @@ -39,57 +36,10 @@ jobs:
pwd
ls -l ..

- name: Run PyTests
timeout-minutes: 20
run: |
ls -l ${GITHUB_WORKSPACE}/
cd ${GITHUB_WORKSPACE}/tests
echo "Current commit is ${{github.sha}}"
pip install -r dragonfly/requirements.txt
export DRAGONFLY_PATH="${GITHUB_WORKSPACE}/build/dragonfly" # used by PyTests
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 # to crash on errors

pytest --json-report --json-report-file=report.json -svr dragonfly --ignore=dragonfly/replication_test.py



- name: Run PyTests replication test
if: ${{ matrix.runner == 'ubuntu-latest' }}
timeout-minutes: 20
run: |
cd ${GITHUB_WORKSPACE}/tests
export DRAGONFLY_PATH="${GITHUB_WORKSPACE}/build/dragonfly" # used by PyTests

pytest --json-report --json-report-file=rep1_report.json -sv dragonfly/replication_test.py --df alsologtostderr --df enable_multi_shard_sync=true
pytest --json-report --json-report-file=rep2_report.json -sv dragonfly/replication_test.py --df alsologtostderr --df enable_multi_shard_sync=false



- name: Send notification on failure
if: failure()
run: |
get_failed_tests() {
local report_file=$1
echo $(jq -r '.tests[] | select(.outcome == "failed") | .nodeid' "$report_file")
}
cd ${GITHUB_WORKSPACE}/tests
failed_tests=""
# The order in of if is important, and expected to be the oposite order of the pytest run.
# As github runner will not run the next step if the pytest failed, we start from the last
# report file and if exist we get the failed test from the pytest run, if there are any.
if [ -f rep2_report.json ]; then
failed_tests=$(get_failed_tests rep2_report.json)
elif [ -f rep1_report.json ]; then
failed_tests=$(get_failed_tests rep1_report.json)
elif [ -f report.json ]; then
failed_tests=$(get_failed_tests report.json)
fi

job_link="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
message="Regression tests failed.\\n The commit is: ${{github.sha}}.\\n $failed_tests \\n Job Link: ${job_link}\\n"

curl -s \
-X POST \
-H 'Content-Type: application/json' \
'${{ secrets.GSPACES_BOT_DF_BUILD }}' \
-d '{"text": "'"${message}"'"}'
- name: Run regression tests action
uses: ./.github/actions/regression-tests
with:
dfly-executable: dragonfly
gspace-secret: ${{ secrets.GSPACES_BOT_DF_BUILD }}
run-only-on-ubuntu-latest: true
build-folder-name: build
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
submodules: true
- name: Configure
run: |
apt update && apt install -y debhelper moreutils
apt update && apt install -y debhelper moreutils pip jq
Copy link
Collaborator

@romange romange Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now have several "apt install" calls in our actions. Let's eliminate them by adding all these packages to ghcr.io/romange/ubuntu-dev . Feel free to send a PR to https://github.com/romange/container-foundry

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already opened a PR.

  1. I would like to add regression tests for arm as well. I know I said offline that it doesn't worth our time, but I am already familiar with most of the gh action staff now that I should be able to find a good solution (and my OCD won't just let me to only run it for x86). The issue is that I could not run the regression tests action as part of the run-on-aarch action. I could simply not find a way to do this properly. Moreover, we only have x86 runners so running on a pure aarch machine was a big no and therefore we require QEMU. But as I looked on your repo, it seems that you already using QEMU which means that I could reuse your images instead of run-on-aarch and therefore I would be able to run that action as separate step (because the OG issue, that I can't run an action in the context of another action, that is, the run-on-aarch).
  2. As I said I made this PR, but I can clean up the release even more once I get the regression tests running on a container explicitly (as opposed to the action). I won't wait for my PR to be merged. I will open a new one to clean up everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/dragonflydb/dragonfly/pull/1706/files

  1. I refactored to use your QEMU docker image instead of the run-on-aarch action
  2. I refactored to use a matrix since both build-native and build-qemu are almost identical (the differences are now arguments to the matrix)
  3. I run the regression tests on aarh as well :)

plz release a new package to your repo such that I can remove the apt install's

- name: Build artifacts
run: |
# Work around https://github.com/actions/checkout/issues/766
Expand All @@ -113,6 +113,13 @@ jobs:
./tools/release.sh
# once the build is over, we want to generate a Debian package
./tools/packaging/generate_debian_package.sh build-opt/dragonfly-x86_64
- name: Run regression tests
uses: ./.github/actions/regression-tests
with:
dfly-executable: dragonfly-x86_64
gspace-secret: ${{ secrets.GSPACES_BOT_DF_BUILD }}
run-only-on-ubuntu-latest: false
build-folder-name: build-opt
- name: Save artifacts
run: |
# place all artifacts at the same location
Expand Down