Skip to content
Permalink
Browse files

Merge branch 'master' into pg_json

  • Loading branch information
stev-0 committed Jan 17, 2020
2 parents 563c333 + 56f40ec commit b11b090b947081a30864a5a6041c552b87741d97
Showing 780 changed files with 43,470 additions and 10,364 deletions.
@@ -11,6 +11,16 @@ services:
- SSL_KEY_FILE=/etc/ssl/private/postgres_key.key
- SSL_CA_FILE=/etc/ssl/certs/issuer_ca_cert.pem

oracle:
image: oslandia/oracle-for-qgis-tests:18.4.0-xe
environment:
- ORACLE_SID=XE
- ORACLE_PWD=adminpass
- ORACLE_PDB=ORCLPDBTEST
- ORACLE_CHARACTERSET=AL32UTF8
ports:
- 1521:1521

# Proving very fragile!
# mssql:
# image: microsoft/mssql-server-linux:2017-latest
@@ -25,7 +35,7 @@ services:
- ${TRAVIS_BUILD_DIR}:/root/QGIS
links:
- postgres
- oracle
# - mssql
env_file:
- docker-variables.env

@@ -52,6 +52,10 @@ cmake \
-DWITH_DESKTOP=ON \
-DWITH_BINDINGS=ON \
-DWITH_SERVER=ON \
-DWITH_ORACLE=ON \
-DENABLE_ORACLETEST=ON \
-DORACLE_INCLUDEDIR="/instantclient_19_3/sdk/include/" \
-DORACLE_LIBDIR="/instantclient_19_3/" \
-DDISABLE_DEPRECATED=ON \
-DPYTHON_TEST_WRAPPER="timeout -sSIGSEGV 55s"\
-DCXX_EXTRA_FLAGS="${CLANG_WARNINGS}" \
@@ -17,7 +17,7 @@ export PGPASSWORD=docker
export PGDATABASE=qgis_test

# wait for the DB to be available
echo "Wait a moment while loading the database."
echo "Wait a moment while loading PostGreSQL database."
while ! PGPASSWORD='docker' psql -h postgres -U docker -p 5432 -l &> /dev/null
do
printf "🐘"
@@ -29,6 +29,26 @@ pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_pg.sh
popd > /dev/null # /root/QGIS

##############################
# Restore Oracle test data
##############################

export ORACLE_HOST="oracle"
export QGIS_ORACLETEST_DBNAME="${ORACLE_HOST}/XEPDB1"
export QGIS_ORACLETEST_DB="host=${QGIS_ORACLETEST_DBNAME} port=1521 user='QGIS' password='qgis'"

echo "Wait a moment while loading Oracle database."
while ! echo exit | sqlplus -L SYSTEM/adminpass@$QGIS_ORACLETEST_DBNAME &> /dev/null
do
printf "."
sleep 1
done
echo " done"

pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
popd > /dev/null # /root/QGIS

# this is proving very flaky:

##############################
@@ -81,6 +101,3 @@ if [ $rv -eq 124 ] ; then
printf '\n\n${bold}Build and test timeout. Please restart the build for meaningful results.${endbold}\n'
exit #$rv
fi



@@ -25,6 +25,7 @@ RUN apt-get update \
git \
graphviz \
grass-dev \
libaio1 \
libexiv2-dev \
libexpat1-dev \
libfcgi-dev \
@@ -96,6 +97,7 @@ RUN apt-get update \
saga \
spawn-fcgi \
txt2tags \
unzip \
xauth \
xfonts-100dpi \
xfonts-75dpi \
@@ -115,6 +117,17 @@ RUN apt-get update \
pyopenssl \
&& apt-get clean

# Oracle : client side
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip > instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip > instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip > instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

RUN unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

ENV PATH="/instantclient_19_3:${PATH}"
ENV LD_LIBRARY_PATH="/instantclient_19_3:${LD_LIBRARY_PATH}"

# MSSQL: client side
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
@@ -26,6 +26,7 @@ RUN apt-get update \
git \
graphviz \
grass-dev \
libaio1 \
libexiv2-dev \
libexpat1-dev \
libfcgi-dev \
@@ -73,6 +74,7 @@ RUN apt-get update \
python3-nose2 \
python3-pip \
python3-psycopg2 \
python3-pyproj \
python3-pyqt5 \
python3-pyqt5.qsci \
python3-pyqt5.qtsql \
@@ -98,6 +100,7 @@ RUN apt-get update \
saga \
spawn-fcgi \
txt2tags \
unzip \
xauth \
xfonts-100dpi \
xfonts-75dpi \
@@ -128,6 +131,17 @@ RUN apt-get update \
six \
&& apt-get clean

# Oracle : client side
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip > instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip > instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip > instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

RUN unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

ENV PATH="/instantclient_19_3:${PATH}"
ENV LD_LIBRARY_PATH="/instantclient_19_3:${LD_LIBRARY_PATH}"

# MSSQL: client side
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
@@ -158,4 +172,3 @@ RUN curl -k https://downloads.kdab.com/clazy/1.6/Clazy-x86_64-1.6.AppImage -o /t
ENV QT_SELECT=5
ENV LANG=C.UTF-8
ENV PATH="/usr/local/bin:${PATH}"

@@ -11,6 +11,7 @@ jobs:
name: Backport
steps:
- name: Backport Bot
if: contains( join(github.event.pull_request.labels.*.name), 'backport')
uses: Gaurav0/backport@v1.0.24
with:
bot_username: qgis-bot
@@ -0,0 +1,140 @@
name: Auto set milestone on PR

# this job is scheduled to be run with proper rights
on:
schedule:
- cron: '* */1 * * *'

env:
QGIS_MAJOR_VERSION: 3

jobs:
pr-without-milestones:
runs-on: ubuntu-latest
steps:
# list the tags and milestones
- uses: octokit/graphql-action@v2.x
id: graphql_request
with:
query: |
query {
repository(owner: "qgis", name: "QGIS") {
pullRequests(states: OPEN, last: 100) {
edges {
node {
number
title
milestone {
number
}
baseRef {
name
}
}
}
}
milestones(orderBy: {field: CREATED_AT, direction: DESC}, first: 50) {
edges {
node {
title
number
}
}
}
refs(refPrefix: "refs/tags/", orderBy: {field: TAG_COMMIT_DATE, direction: DESC}, first: 30) {
edges {
node {
name
}
}
}
}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# take the first unprocessed PR and determine if some remain
- name: Filter PR to check
id: extract_data
env:
JSON_DATA: ${{ steps.graphql_request.outputs.data }}
run: |
# get PRs without milestones
PRS_TO_PROCESS=$(echo "${JSON_DATA}" | jq '.repository.pullRequests.edges[] | select( .node.milestone.number | not ) | .node.number')

NUMBER_OF_PRS=$(echo "${PRS_TO_PROCESS}" | jq -s '. | length')
echo "NUMBER_OF_PRS: ${NUMBER_OF_PRS}"
# early exit
[[ ${NUMBER_OF_PRS} == 0 ]] && echo "::set-output name=has_milestone_to_set::0" && exit 0

# Take the first
PR_NUMBER=$(echo "${PRS_TO_PROCESS}" | jq -s '. | first')
echo "PR_NUMBER: ${PR_NUMBER}"

# Not used for now
RE_RUN_JOB=$(echo "${JSON_DATA}" | jq -s '. | length > 1')
echo "RE_RUN_JOB: ${RE_RUN_JOB}"

# Get the base branch
BASE_BRANCH=$(echo "${JSON_DATA}" | jq ".repository.pullRequests.edges[] | select( .node.number == ${PR_NUMBER} ) | .node.baseRef.name")
echo "BASE_BRANCH: ${BASE_BRANCH}"

# master => NOTHING, release_3-10 => _10
MINOR_VERSION=$(echo ${BASE_BRANCH} | sed -r -e 's/^release-[0-9]_([0-9]+)/_\1/;t;d')
echo "MINOR_VERSION: ${MINOR_VERSION}"

# get the max release from the tags
MAX_RELEASE=$(echo "${JSON_DATA}" | jq ".repository.refs.edges[].node.name | select( . | test(\"^final-${QGIS_MAJOR_VERSION}${MINOR_VERSION}\") ) | sub(\"^final-${QGIS_MAJOR_VERSION}_(?<m>[0-9]+)_(?<p>.)\"; .m+\".\"+.p) | tonumber" | jq -s '. | max')
echo "MAX_RELEASE: ${MAX_RELEASE}"

# increase the number to get milestone: round+2 for master, +0.1 for release_xxx branches
INCREASE_OPERATION=$([[ -z ${MINOR_VERSION} ]] && echo "${MAX_RELEASE%.*} + 2.0" || echo "${MAX_RELEASE} + 0.1" )
echo "INCREASE_OPERATION: ${INCREASE_OPERATION}"
MILESTONE_TITLE="${QGIS_MAJOR_VERSION}."$(echo "${INCREASE_OPERATION}" | bc)
echo "MILESTONE_TITLE: ${MILESTONE_TITLE}"

MILESTONE_NUMBER=$(echo "${JSON_DATA}" | jq ".repository.milestones.edges[] | select( .node.title == \"${MILESTONE_TITLE}\" ) | .node.number")
echo "MILESTONE_NUMBER: ${MILESTONE_NUMBER}"

HAS_MILESTONE_TO_CREATE=$([[ -z ${MILESTONE_NUMBER} ]] && echo "1" || echo "0" )
echo "HAS_MILESTONE_TO_CREATE: ${HAS_MILESTONE_TO_CREATE}"

echo "::set-output name=has_milestone_to_set::1"
echo "::set-output name=pr_number::${PR_NUMBER}"
echo "::set-output name=milestone_title::${MILESTONE_TITLE}"
echo "::set-output name=milestone_number::${MILESTONE_NUMBER}"
echo "::set-output name=has_milestone_to_create::${HAS_MILESTONE_TO_CREATE}"

# create the milestone if needed
- name: Create milestone if needed
id: create_milestone
if: steps.extract_data.outputs.has_milestone_to_set == 1 && steps.extract_data.outputs.has_milestone_to_create == 1
uses: octokit/request-action@v2.x
with:
route: POST /repos/qgis/QGIS/milestones
title: ${{ steps.extract_data.outputs.milestone_title }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Compute the milestone number
- name: Compute milestone number from existing or created
id: compute_milestone
if: always() && steps.extract_data.outputs.has_milestone_to_set == 1
env:
MILESTONE_NUMBER_EXISTING: ${{ steps.extract_data.outputs.milestone_number }}
MILESTONE_NUMBER_CREATED_JSON: ${{ steps.create_milestone.outputs.data }}
run: |
FINAL_MILESTONE_NUMBER=$([[ -n ${MILESTONE_NUMBER_EXISTING} ]] && echo "${MILESTONE_NUMBER_EXISTING}" || $(echo "${MILESTONE_NUMBER_CREATED_JSON}" | jq '.number' ))
echo "FINAL_MILESTONE_NUMBER: ${FINAL_MILESTONE_NUMBER}"
echo "::set-output name=milestone_number::${FINAL_MILESTONE_NUMBER}"

# update PR with milestone
- name: update PR milestone
if: steps.extract_data.outputs.has_milestone_to_set == 1
uses: octokit/request-action@v2.x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: PATCH /repos/qgis/QGIS/issues/:pull_number
pull_number: ${{ steps.extract_data.outputs.pr_number }}
milestone: ${{ steps.compute_milestone.outputs.milestone_number }}
@@ -0,0 +1,37 @@
name: Ping PR author about documentation

on:
pull_request:
types:
- opened
- labeled
jobs:
test:
if: contains( github.event.pull_request.labels.*.name, 'Needs Documentation')
runs-on: ubuntu-latest
steps:
# obfuscate the github token so it can be used on jobs triggered from forks
- name: Clear GH Token
id: token
uses: opengisch/clear-token@v1.0.12
with:
bot_token_encrypted: ddbdec32940df79f1adf2369b4b10f10b5a66f65
bot_token_xor_key: a1b2c3d47311f8e29e204f85a81b4df4a44e252c

# write comment to ping the PR author
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ steps.token.outputs.token }}
issue-number: ${{ github.event.pull_request.number }}
body: |
@${{ github.event.pull_request.user.login }}
This pull request has been tagged as **requiring documentation**.
A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation **when this PR is merged**.
**Please update the description** (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.
Thank you!
reaction-type: 'rocket'
@@ -0,0 +1,20 @@
## How to use it

1) Create a PR
2) Tag it with "Needs Documentation"
3) Optionally set the milestone to it
4) Merge it

Then
* a message will be added to PR to ping the author about her/his responsibility to handle the documentation issue
* an issue is automatically created in the QGIS-Documentation repository when the PR gets merged

Example:
* Dummy PR: https://github.com/qgis/QGIS/pull/33525
* Auto created issue: https://github.com/qgis/QGIS-Documentation/issues/4763

## How it works

* A Github [workflow]( https://github.com/qgis/QGIS/blob/master/.github/workflows/pr_to_doc_issue.yml) takes care of creating the issue and commenting.
* To make it works on jobs triggered from forks (almost all PRs actually), the Github token has to be manually given. Since it cannot be written in clear, an [action](https://github.com/opengisch/clear-token) obfuscates its using xor encryption.
* The labels on QGIS-Documentation are deduced from the PR milestone (e.g. 3.10.2 => 3.10). To label issues, push access is required. Due to security reasons (the token appears in clear), qgis-bot has no specific rights. Labels are created using a [workflow](https://github.com/qgis/QGIS-Documentation/blob/master/.github/workflows/auto-label.yml).

0 comments on commit b11b090

Please sign in to comment.
You can’t perform that action at this time.