Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 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
3c5afe7
wip
kostasrim Aug 16, 2023
cf19ac3
chore: refactor release to use matrix
kostasrim Aug 16, 2023
8b8f9f0
fix naming
kostasrim Aug 16, 2023
c6944dc
try
kostasrim Aug 16, 2023
575058c
add specific image
kostasrim Aug 16, 2023
3ed27e5
enable build only for x86
kostasrim Aug 16, 2023
aef3e99
enable arm build without replication tests
kostasrim Aug 16, 2023
882b31b
try
kostasrim Aug 16, 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}"'"}'
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: ci-tests

on:
# push:
# branches: [ main ]
pull_request:
branches: [main]
workflow_dispatch:
#on:
# # push:
# # branches: [ main ]
# pull_request:
# branches: [main]
# workflow_dispatch:

jobs:
pre-commit:
Expand Down
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
169 changes: 65 additions & 104 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: Version Release

#on:
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 will remove these, used for testing only

# push:
# tags:
# - 'v*'
#
on:
push:
tags:
- 'v*'
# push:
# branches: [ main ]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: write
Expand All @@ -15,104 +22,57 @@ jobs:
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: temp
allowUpdates: true
omitBody: true
prerelease: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}

build-qemu:
runs-on: ubuntu-latest
name: Build aarch64 on ubuntu20.04
needs: create-release
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache build deps
id: cache-deps
uses: actions/cache@v3
with:
path: |
${{github.workspace}}/build-opt/
!${{github.workspace}}/build-opt/CMakeCache.txt
key: ${{ runner.os }}-release-deps-${{ github.sha }}
#restore-keys: |
# ${{ runner.os }}-release-deps-

- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: aarch64
distro: ubuntu20.04
githubToken: ${{ github.token }}
# Create an artifacts directory
setup: |
mkdir -p "${PWD}/artifacts"

# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${{ github.workspace }}:/src"
# The shell to run commands with in the container
shell: /bin/bash
install: |
export DEBIAN_FRONTEND=noninteractive
apt update && apt install -q -y autoconf-archive cmake curl git libssl-dev \
libunwind-dev ninja-build libtool gcc-9 g++-9 libboost-fiber-dev \
libxml2-dev zip libzstd-dev debhelper moreutils bison
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
run: |
# Work around https://github.com/actions/checkout/issues/766
git config --global --add safe.directory /src
cd /src
git describe --always --tags ${{ github.sha }}

if [ -d build-opt ]; then
chown -R root build-opt
ls -l ./build-opt
for i in `ls -d ./build-opt/_deps/*-src`; do
git config --global --add safe.directory $(realpath $i)
done
fi
./tools/release.sh
./tools/packaging/generate_debian_package.sh build-opt/dragonfly-aarch64
mv dragonfly_*.deb build-opt/
- name: Show the artifact
# Items placed in /src/build-opt in the container will be in
# ${PWD}/build-opt on the host.
run: |
echo finished
ls -al
- name: Upload
uses: actions/upload-artifact@v3
with:
name: dragonfly-aarch64
path: |
build-opt/dragonfly-*tar.gz
build-opt/dragonfly_*.deb

build-native:
runs-on: ubuntu-latest
needs: create-release
build:
strategy:
matrix:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now use a matrix!

# Test of these containers
container: ["ubuntu-dev:20"]
runner: [[linux, arm64], [ubuntu-20.04]]
include:
- container: "ubuntu-dev:20"
runner: [linux, arm64]
df-binary-name: dragonfly-aarch64
platform: aarch64
name: dragonfly-aarch64
not-replication: true
- container: "ubuntu-dev:20"
runner: [ubuntu-20.04]
df-binary-name: dragonfly-x86_64
platform: x86_64
name: dragonfly-amd64
not-replication: false
runs-on: ${{ matrix.runner }}
container:
image: ghcr.io/romange/ubuntu-dev:20
image: ghcr.io/romange/${{ matrix.container }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once we release the new packages, I will remove apt-install from here :)

name: Build ${{ matrix.platform }} on ubuntu20.04
needs: create-release
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: |
apt update && apt install -y debhelper moreutils
- name: Build artifacts
run: |
# Work around https://github.com/actions/checkout/issues/766
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git describe --always --tags ${{ github.sha }}
./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
./tools/packaging/generate_debian_package.sh build-opt/${{ matrix.df-binary-name}}
mv dragonfly_*.deb build-opt/
ls -lah build-opt
- name: Run regression tests
uses: ./.github/actions/regression-tests
with:
dfly-executable: ${{ matrix.df-binary-name }}
gspace-secret: ${{ secrets.GSPACES_BOT_DF_BUILD }}
run-only-on-ubuntu-latest: ${{ matrix.not-replication }}
build-folder-name: build-opt
- name: Save artifacts
run: |
# place all artifacts at the same location
Expand All @@ -122,24 +82,25 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: dragonfly-amd64
name: ${{ matrix.name }}
path: results-artifacts/*
publish_release:
runs-on: ubuntu-latest
needs: [build-native, build-qemu]
steps:
- uses: actions/download-artifact@v3
name: Download files
with:
path: artifacts
- name: See all the artifacts
run: |
ls -lR artifacts/
- uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/dragonfly-*/*"
allowUpdates: true
draft: true
prerelease: true
omitNameDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}

# publish_release:
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - uses: actions/download-artifact@v3
# name: Download files
# with:
# path: artifacts
# - name: See all the artifacts
# run: |
# ls -lR artifacts/
# - uses: ncipollo/release-action@v1
# with:
# artifacts: "artifacts/dragonfly-*/*"
# allowUpdates: true
# draft: true
# prerelease: true
# omitNameDuringUpdate: true
# token: ${{ secrets.GITHUB_TOKEN }}