Skip to content

Commit

Permalink
Merge branch 'v2.x' into CodeQL
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder authored Feb 22, 2023
2 parents e615036 + 294c4f5 commit be7d6c0
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 11 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci-selftests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI-selftests

on:
push:
branches: [ "v2.x" ]
paths-ignore:
- '.github/**'
- '**.md'
pull_request:
branches: [ "v2.x" ]
paths-ignore:
- '.github/**'
- '**.md'
# schedule:
# - cron: '15 13 * * 3'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Install build tools
run: sudo apt-get -y install make automake git wget gcc g++ libtool equivs python3 valgrind

- name: Install build dependencies
run: sudo apt-get -y install libssl-dev gnutls-dev libgnutls28-dev libmysqlclient-dev libboost-all-dev libunwind8 libunwind-dev uuid-dev ca-certificates

- name: Install test tools
run: sudo apt-get -y install mysql-client

- name: Checkout repository
uses: actions/checkout@v3

- name: Git describe
env:
GH_TOKEN: ${{ github.token }}
run: |
export VERS=$(git ls-remote https://github.com/sysown/proxysql.git "refs/tags/*" | grep -v 'refs/tags/v' | sed -e 's|.*/||g' | tail -2 | head -1)
export HASH=$(gh api repos/sysown/proxysql/git/refs/heads/v2.x | jq '.object.sha' | cut -c2-8)
export CMTS=$(gh api repos/sysown/proxysql/compare/${VERS}...v2.x | jq '.ahead_by')
echo "git descibe : ${VERS}-${CMTS}-g${HASH}"
echo "GIT_VERSION=${VERS}-${CMTS}-g${HASH}" >> $GITHUB_ENV
- name: Build
run: |
make debug_clickhouse
- name: Self-tests
run: |
ulimit -c unlimited
set +e
set -o pipefail
set -x
cd src && (./proxysql -f --initial --clickhouse --idle-threads -D . &>proxysql.log &)
sleep 30
mysql -V -vvv
mysql -uadmin -padmin -h127.0.0.1 -P6032 -vvv -e "SELECT version();" 2>&1 | grep -v 'Using a password'
mysql -uadmin -padmin -h127.0.0.1 -P6032 -vvv -e "SET mysql-verbose_query_error=true;" 2>&1 | grep -v 'Using a password'
mysql -uadmin -padmin -h127.0.0.1 -P6032 -vvv 2>&1 << EOF | grep -v 'Using a password'
SELECT COUNT(*) FROM stats_mysql_query_digest;
SELECT COUNT(*) FROM stats_mysql_query_digest_reset;
SELECT schemaname, COUNT(*) FROM stats_mysql_query_digest GROUP BY schemaname;
SELECT schemaname, COUNT(*) FROM stats_mysql_query_digest_reset GROUP BY schemaname;
TRUNCATE TABLE stats.stats_mysql_query_digest_reset;
TRUNCATE TABLE stats.stats_mysql_query_digest;
PROXYSQLTEST 1 1000;
PROXYSQLTEST 2 1000;
PROXYSQLTEST 3 1000;
PROXYSQLTEST 4 1000;
PROXYSQLTEST 5 1000;
PROXYSQLTEST 6 1000;
EOF
RC=$?
mysql -uadmin -padmin -h127.0.0.1 -P6032 -vvv -e "PROXYSQL SHUTDOWN SLOW;" 2>&1 | grep -v 'Using a password'
sleep 30
echo 'DONE'
exit $RC
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: artifacts-${{ github.run_number }}
path: |
./src/
32 changes: 24 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@
name: "CodeQL"

on:
# push:
# branches: [ CodeQL ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ CodeQL ]
push:
branches: [ v2.x ]
paths-ignore:
- '.github/**'
- '**.md'
pull_request:
# The branches below must be a subset of the branches above
branches: [ v2.x ]
paths-ignore:
- '.github/**'
- '**.md'
# schedule:
# - cron: '15 13 * * 3'
workflow_dispatch:
Expand Down Expand Up @@ -48,7 +54,7 @@ jobs:
run: sudo apt-get -y install libssl-dev gnutls-dev libgnutls28-dev libmysqlclient-dev libboost-all-dev libunwind8 libunwind-dev uuid-dev ca-certificates

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down Expand Up @@ -79,12 +85,22 @@ jobs:
- if: matrix.language == 'python' || matrix.language == 'java'
name: Autobuild
uses: github/codeql-action/autobuild@v2


- name: Git describe
env:
GH_TOKEN: ${{ github.token }}
run: |
export VERS=$(git ls-remote https://github.com/sysown/proxysql.git "refs/tags/*" | grep -v 'refs/tags/v' | sed -e 's|.*/||g' | tail -2 | head -1)
export HASH=$(gh api repos/sysown/proxysql/git/refs/heads/v2.x | jq '.object.sha' | cut -c2-8)
export CMTS=$(gh api repos/sysown/proxysql/compare/${VERS}...v2.x | jq '.ahead_by')
echo "git descibe : ${VERS}-${CMTS}-g${HASH}"
echo "GIT_VERSION=${VERS}-${CMTS}-g${HASH}" >> $GITHUB_ENV
- if: matrix.language == 'cpp'
name: Build C++
run: |
export GIT_VERSION=2.5.0-0-g0000000
make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ deps/libinjection/libinjection-*/
deps/libmicrohttpd/libmicrohttpd-*/
deps/libmicrohttpd/libmicrohttpd
deps/libssl/openssl-openssl-*/
deps/libssl/openssl-*/
deps/lz4/lz4-*/
deps/mariadb-client-library/mariadb-connector-c-*/
deps/pcre/pcre-*/
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![CI-selftests](https://github.com/sysown/proxysql/actions/workflows/ci-selftests.yml/badge.svg)](https://github.com/sysown/proxysql/actions/workflows/ci-selftests.yml)
[![CodeQL](https://github.com/sysown/proxysql/actions/workflows/codeql.yml/badge.svg)](https://github.com/sysown/proxysql/actions/workflows/codeql.yml)

<a><img src="https://i0.wp.com/proxysql.com/wp-content/uploads/2020/04/ProxySQL-Colour-Logo.png?fit=800%2C278&ssl=1" alt="ProxySQL"></a>

Introduction
Expand Down
14 changes: 12 additions & 2 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,30 @@ libinjection: libinjection/libinjection/src/libinjection.a
libssl/openssl/libssl.a:
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libssl && tar -zxf openssl-*.tar.gz
cd libssl/openssl && patch crypto/ec/curve448/curve448.c < ../curve448.c-multiplication-overflow.patch
cd libssl/openssl && patch crypto/asn1/a_time.c < ../a_time.c-multiplication-overflow.patch
# cd libssl/openssl && patch crypto/ec/curve448/curve448.c < ../curve448.c-multiplication-overflow.patch
# cd libssl/openssl && patch crypto/asn1/a_time.c < ../a_time.c-multiplication-overflow.patch
cd libssl/openssl && ./config no-ssl3 no-tests
cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE}
cd libssl/openssl && ln -s . lib # curl wants this path

libssl: libssl/openssl/libssl.a

MIN_VERSION := 4.9.0
GCC_VERSION := $(shell gcc -dumpversion)
SORTED_VERSIONS := $(shell echo -e "$(GCC_VERSION)\n$(MIN_VERSION)" | sort -V)

REQUIRE_PATCH = false
ifeq ($(MIN_VERSION),$(lastword $(SORTED_VERSIONS)))
REQUIRE_PATCH = true
endif

libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a re2/re2/obj/libre2.a
cd libhttpserver && rm -rf libhttpserver-*/ || true
cd libhttpserver && tar -zxf libhttpserver-*.tar.gz
#ifeq ($(REQUIRE_PATCH), true)
cd libhttpserver/libhttpserver && patch -p1 < ../noexcept.patch
cd libhttpserver/libhttpserver && patch -p1 < ../re2_regex.patch
#endif
cd libhttpserver/libhttpserver && patch -p1 < ../final_val_post_process.patch
cd libhttpserver/libhttpserver && patch -p1 < ../empty_uri_log_crash.patch
ifeq ($(UNAME_S),FreeBSD)
Expand Down
2 changes: 1 addition & 1 deletion deps/libssl/openssl
Binary file not shown.
6 changes: 6 additions & 0 deletions deps/libssl/verify-bio_st-match.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
pushd $(dirname $0) &>/dev/null
trap 'popd &>/dev/null' EXIT

echo "checking for './deps/libssl/openssl/crypto/bio/bio_local.h'"
if [[ ! -e './openssl/crypto/bio/bio_local.h' ]]; then
echo "extracting 'openssl-*.tar.gz'"
tar -zxf openssl-*.tar.gz
fi

echo "extracting 'struct bio_st' from './deps/libssl/openssl/crypto/bio/bio_local.h'"
DEPBIOST=$(cd ../../; cat ./deps/libssl/openssl/crypto/bio/bio_local.h | sed -n '/^struct bio_st {/,/}/p')

Expand Down

0 comments on commit be7d6c0

Please sign in to comment.