Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] test publishing after testing #99

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e504f19
Add tests for backported federated-properties
toban Mar 1, 2021
28cb2d6
Test pingback
toban Mar 2, 2021
84829fe
Add wikibase manifest
toban Mar 3, 2021
2eec698
T275216: make git tagging just output commands
toban Mar 3, 2021
1d66453
Add git tagging for wikibase manifest
toban Mar 3, 2021
9a818a3
change composer image to (#85)
toban Mar 4, 2021
18b949f
Merge branch 'main' into test-fedprops-1_35
toban Mar 4, 2021
1bc7ff9
Merge branch 'main' into add-manifest
toban Mar 4, 2021
b650852
Some changes to elasticsearch.js
toban Mar 4, 2021
cd09811
Merge branch 'main' into test-pingback
toban Mar 4, 2021
2639b59
use pingbackHost
toban Mar 4, 2021
6cdb85b
Merge branch 'add-manifest' into make-publish-just-output-text
toban Mar 4, 2021
5ce756c
Merge branch 'make-publish-just-output-text' into add-manifest-tagging
toban Mar 4, 2021
c977286
Merge pull request #78 from wmde/test-fedprops-1_35
mariushoch Mar 4, 2021
c06f132
add quotes to commandline parameters
toban Mar 4, 2021
b3a9757
move to dbQuery function
toban Mar 4, 2021
48d0e01
Merge branch 'main' into test-pingback
toban Mar 4, 2021
5d804e9
Merge branch 'main' into add-manifest
toban Mar 4, 2021
0036114
Merge branch 'add-manifest' into make-publish-just-output-text
toban Mar 5, 2021
5c21bb9
REL1_35 is using php7.3
toban Mar 5, 2021
abd6239
Add entityschema to bundle
toban Mar 5, 2021
5de3da1
Merge pull request #88 from wmde/composer-REL1_35-uses-php73
mariushoch Mar 9, 2021
58db636
Merge pull request #81 from wmde/test-pingback
mariushoch Mar 9, 2021
213dae5
Merge pull request #86 from wmde/elasticsearch-test-clarification
mariushoch Mar 9, 2021
abda743
Add pingback to "make test-all", clean up pingback/docker-compose.ove…
mariushoch Mar 9, 2021
95d18bd
Set job run rate to 2 by default.
toban Mar 9, 2021
953ae72
Merge branch 'main' into bump-job-run-rate
toban Mar 9, 2021
78dcc16
remove extra space
toban Mar 9, 2021
43e3a1f
Add UniversalLanguageSelector to bundle
toban Mar 9, 2021
7ab4030
update docs
toban Mar 9, 2021
be73553
Add cldr to bundle
toban Mar 9, 2021
2cd8902
Merge pull request #83 from wmde/make-publish-just-output-text
mariushoch Mar 9, 2021
2472452
Merge pull request #82 from wmde/add-manifest
mariushoch Mar 9, 2021
4bf6e82
Merge branch 'main' into add-entity-schema
mariushoch Mar 9, 2021
bbeed5a
Merge branch 'main' into add-cldr
mariushoch Mar 9, 2021
3a64d85
Add SELENIUM_LOG_LEVEL
toban Mar 10, 2021
24e1734
download_artifacts: Nicely show github API errors (#93)
mariushoch Mar 10, 2021
ab0f1f2
Merge branch 'main' into add-uls
toban Mar 10, 2021
f10d723
remove unnecessary focus
toban Mar 10, 2021
9ce7b14
Drop unused code in tag_git Dockerfile
toban Mar 10, 2021
0c454ca
Add VisualEditor to bundle
toban Mar 10, 2021
881aa86
Merge pull request #87 from wmde/add-entity-schema
mariushoch Mar 10, 2021
ea2179f
Fix error on reporter
toban Mar 10, 2021
b2c1009
Merge pull request #96 from wmde/drop-unused-code
mariushoch Mar 10, 2021
b7fb236
Merge pull request #90 from wmde/bump-job-run-rate
mariushoch Mar 10, 2021
2e84704
Merge pull request #94 from wmde/add-visual-editor
mariushoch Mar 10, 2021
3f027ba
Merge pull request #97 from wmde/fix-reporter
mariushoch Mar 10, 2021
582cba9
Merge branch 'main' into add-visual-editor-to-bundle
toban Mar 10, 2021
7a9b893
Merge branch 'main' into add-uls
toban Mar 10, 2021
15cde4f
Merge pull request #92 from wmde/add-cldr
mariushoch Mar 10, 2021
ff1e0b2
Merge pull request #84 from wmde/add-manifest-tagging
mariushoch Mar 10, 2021
d1402f9
Merge pull request #91 from wmde/add-uls
mariushoch Mar 10, 2021
28218f6
Merge branch 'main' into add-visual-editor-to-bundle
mariushoch Mar 10, 2021
461f991
Check for presence of CLDR (#98)
mariushoch Mar 10, 2021
ae9d237
Merge branch 'main' into add-visual-editor-to-bundle
mariushoch Mar 10, 2021
ce3be60
Merge pull request #95 from wmde/add-visual-editor-to-bundle
mariushoch Mar 10, 2021
cedb403
use test-access-token
toban Mar 12, 2021
0ccd862
test publishing after testing
toban Mar 12, 2021
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
45 changes: 44 additions & 1 deletion .github/workflows/built_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
env:
env_file: ${{ github.event.inputs.env_file || '.env' }}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.TEST_DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_REPOSITORY_NAME: toanwmde
DOCKER_HUB_ID: toanwmde
WORKFLOW_RUN_NUMBER: ${{ github.run_id }}

jobs:
build_mediawiki:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -139,6 +145,13 @@ jobs:
if-no-files-found: error
path: artifacts/wikibase-bundle.docker.tar.gz

- name: Archive metadata artifacts
uses: actions/upload-artifact@v2
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/build_metadata_*.env

build_quickstatements:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -247,7 +260,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: [ repo, fedprops, repo-client, quickstatements ]
suite: [ pingback ]
needs:
- build_wikibase_bundle
- build_queryservice
Expand Down Expand Up @@ -280,3 +293,33 @@ jobs:
name: TestArtifacts
path: |
test/log

should_publish:
needs:
- test_wikibase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: ${{ env.env_file }}

- name: Cache git_cache repos
uses: actions/cache@v2
env:
cache-name: cache-build-metadata
with:
path: artifacts/LastBuildMetadata
key: cache-build-metadata

- name: Get BuildMetadata artifacts
uses: actions/download-artifact@v2
with:
name: BuildMetadata
path: artifacts/

- name: Check if something changed
run: bash publish/should_publish.sh
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
env:
env_file: ${{ github.event.inputs.env_file }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.TEST_DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_REPOSITORY_NAME: toanwmde
DOCKER_HUB_ID: toanwmde
WORKFLOW_RUN_NUMBER: ${{ github.event.inputs.workflow_run_number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: [ repo, fedprops, repo-client ]
suite: [ repo, fedprops, repo-client, quickstatements, pingback ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 3 additions & 1 deletion Docker/build/Wikibase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ COPY htaccess /var/www/html/.htaccess
RUN ln -s /var/www/html/ /var/www/html/w

ENV MW_SITE_NAME=wikibase-docker\
MW_SITE_LANG=en
MW_SITE_LANG=en\
MW_WG_JOB_RUN_RATE=2\
WIKIBASE_PINGBACK=false

ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]
6 changes: 6 additions & 0 deletions Docker/build/Wikibase/LocalSettings.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ ${DOLLAR}wgRCMaxAge = 365 * 24 * 3600;

wfLoadSkin( 'Vector' );

// T276905 - default set in Dockerfile
${DOLLAR}wgJobRunRate = ${MW_WG_JOB_RUN_RATE};

## Wikibase
# Load Wikibase repo & client with the example / default settings.
require_once "${DOLLAR}IP/extensions/Wikibase/repo/Wikibase.php";
require_once "${DOLLAR}IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "${DOLLAR}IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "${DOLLAR}IP/extensions/Wikibase/client/ExampleSettings.php";

#Pingback
${DOLLAR}wgWBRepoSettings['wikibasePingback'] = ${WIKIBASE_PINGBACK};

foreach (glob("LocalSettings.d/*.php") as ${DOLLAR}filename)
{
include ${DOLLAR}filename;
Expand Down
9 changes: 9 additions & 0 deletions Docker/build/WikibaseBundle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ FROM ${WIKIBASE_IMAGE_NAME}:latest
RUN rm -rf /var/www/html/vendor
COPY --from=composer /var/www/html /var/www/html
COPY extra-install.sh /extra-install.sh

# copy extension settings
COPY LocalSettings.WikibaseManifest.php /var/www/html/LocalSettings.d/WikibaseManifest.php
COPY LocalSettings.OAuth.php /var/www/html/LocalSettings.d/OAuth.php
COPY LocalSettings.UniversalLanguageSelector.php /var/www/html/LocalSettings.d/UniversalLanguageSelector.php
COPY LocalSettings.EntitySchema.php /var/www/html/LocalSettings.d/EntitySchema.php
COPY LocalSettings.Scribunto.php /var/www/html/LocalSettings.d/Scribunto.php
COPY LocalSettings.VisualEditor.php /var/www/html/LocalSettings.d/VisualEditor.php
COPY LocalSettings.cldr.php /var/www/html/LocalSettings.d/cldr.php

# copy template for envsubst
COPY LocalSettings.Elasticsearch.php.template /var/www/html/LocalSettings.template.d/
5 changes: 5 additions & 0 deletions Docker/build/WikibaseBundle/LocalSettings.EntitySchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

// https://www.mediawiki.org/wiki/Extension:EntitySchema
## EntitySchema Configuration
wfLoadExtension( 'EntitySchema' );
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

// https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector
## UniversalLanguageSelector Extension
wfLoadExtension( 'UniversalLanguageSelector' );
6 changes: 6 additions & 0 deletions Docker/build/WikibaseBundle/LocalSettings.VisualEditor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// https://www.mediawiki.org/wiki/Extension:VisualEditor
## VisualEditor Extension
wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'Parsoid', 'vendor/wikimedia/parsoid/extension.json' );
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// https://www.mediawiki.org/wiki/Extension:WikibaseManifest

## WikibaseManifest Configuration
$wgEnableRestAPI = true;
wfLoadExtension( 'WikibaseManifest' );
5 changes: 5 additions & 0 deletions Docker/build/WikibaseBundle/LocalSettings.cldr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

// https://www.mediawiki.org/wiki/Extension:CLDR
## CLDR Extension
wfLoadExtension( 'cldr' );
8 changes: 8 additions & 0 deletions Docker/publish/download_artifacts/download_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
print('Downloading %d bytes from %s' % (artifact['size_in_bytes'], artifact['name']))

r = requests.get( artifact['archive_download_url'], allow_redirects=True, headers={"Authorization": 'Bearer ' + os.getenv('GITHUB_TOKEN') } )
if r.status_code != 200:
errorMessage = "Unknown error (http " + str(r.status_code) + ")."
try:
errorMessage = r.json()['message']
except:
pass
raise Exception("Github API request failed: " + errorMessage)

zipfilePath = os.path.join('/zips' ,artifact['name'] + '.zip')
open(zipfilePath, 'wb').write(r.content)

Expand Down
5 changes: 0 additions & 5 deletions Docker/publish/tag_git/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
FROM docker-registry.wikimedia.org/wikimedia-buster:latest

RUN apt-get update && \
apt-get install --yes --no-install-recommends git ca-certificates=201* && \
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY ./tag_git.sh /tag_git.sh
RUN mkdir /repo
ENTRYPOINT [ "/bin/bash", "/tag_git.sh" ]
44 changes: 13 additions & 31 deletions Docker/publish/tag_git/tag_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,26 @@ if [ -z "$WIKIBASE_BRANCH_NAME" ] || \
[ -z "$WMDE_RELEASE_VERSION" ] || \
[ -z "$METADATA_WDQS_UI_COMMIT_HASH" ] || \
[ -z "$METADATA_WIKIBASE_COMMIT_HASH" ] || \
[ -z "$METADATA_WIKIBASEMANIFEST_COMMIT_HASH" ] || \
[ -z "$WORKFLOW_RUN_NUMBER" ] ; then
echo "A variable is required but isn't set. You should pass it to docker. See: https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file";
exit 1;
fi

function tag_and_push {
REPOSITORY_CACHE_NAME=$1
CHECKOUT_DIR=$2
BRANCH_NAME=$3
COMMIT_HASH=$4
REMOTE_URL=$5

git clone --single-branch --branch "${BRANCH_NAME}" "$REPOSITORY_CACHE_NAME" "$CHECKOUT_DIR"
cd "$CHECKOUT_DIR"

echo "Tagging $WMDE_RELEASE_VERSION at $COMMIT_HASH"
git tag --force -a "$WMDE_RELEASE_VERSION" "$COMMIT_HASH" -m "Tagging: $WMDE_RELEASE_VERSION Build: $WORKFLOW_RUN_NUMBER"

if [ -z "$DRY_RUN" ]; then
git remote set-url origin "$REMOTE_URL"
git push --tags
else
echo "DRY RUN! Not pushing anything"
fi

cd -
function echo_tag {
COMMIT_HASH=$1
REPO_NAME=$2
echo
echo "Use the following tag on $REPO_NAME"
echo "git tag --force -a \"$WMDE_RELEASE_VERSION\" \"$COMMIT_HASH\" -m \"Tagging: $WMDE_RELEASE_VERSION Build: $WORKFLOW_RUN_NUMBER\""
echo
}

# tag and push Wikibase
tag_and_push "/git_cache/Wikibase.git" \
"/repo/Wikibase" \
"$WIKIBASE_BRANCH_NAME" \
"$METADATA_WIKIBASE_COMMIT_HASH" \
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
echo_tag "$METADATA_WIKIBASE_COMMIT_HASH" "Wikibase"

# tag and push queryservice ui
tag_and_push "/git_cache/services/wikidata-query-gui.git" \
"/repo/wdqs-frontend" \
master \
"$METADATA_WDQS_UI_COMMIT_HASH" \
ssh://gerrit.wikimedia.org:29418/wikidata/query/gui
echo_tag "$METADATA_WDQS_UI_COMMIT_HASH" "Queryservice UI"

# tag and push WikibaseManifest
echo_tag "$METADATA_WIKIBASEMANIFEST_COMMIT_HASH" "Wikibase Manifest"
3 changes: 3 additions & 0 deletions Docker/test/selenium/data/entityschema.sx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<something> {
wdt:P1 [wd:Q1]
}
64 changes: 62 additions & 2 deletions Docker/test/selenium/helpers/default-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const axios = require( 'axios' );
const assert = require( 'assert' );
const exec = require( 'child_process' ).exec;
const _ = require( 'lodash' );
const MWBot = require( 'mwbot' );

const defaultFunctions = function () {

Expand All @@ -14,6 +15,48 @@ const defaultFunctions = function () {
return axios.get( url );
} );

/**
* Execute query on database
*/
browser.addCommand( 'dbQuery', function async( query, config ) {
if ( !config ) {
config = {
user: process.env.DB_USER,
pass: process.env.DB_PASS,
database: process.env.DB_NAME
};
}

return browser.dockerExecute(
process.env.DOCKER_MYSQL_NAME,
'mysql --user "' + config.user + '"' +
' --password="' + config.pass + '" "' + config.database + '"' +
" -e '" + query + "'"
);
} );

/**
* Delete a claim by guid or pipe-separated list of guids
*/
browser.addCommand( 'deleteClaim', function async( claimGuid ) {
const bot = new MWBot( {
apiUrl: `${browser.config.baseUrl}/api.php`
} );

return new Promise( ( resolve ) => {
bot.getEditToken()
.then( () => {
bot.request( {
action: 'wbremoveclaims',
claim: claimGuid,
token: bot.editToken
} ).then( ( response ) => {
resolve( response );
} );
} );
} );
} );

/**
* Execute docker command on container and get output
*/
Expand Down Expand Up @@ -43,10 +86,27 @@ const defaultFunctions = function () {
*/
browser.addCommand( 'editPage', function editPage( host, title, content ) {
browser.url( host + '/wiki/' + title + '?action=edit' );

// wait for javascript to settle
browser.pause( 5 * 1000 );

// this shows up one time for anonymous users (VisualEditor)
const startEditbutton = $( '.oo-ui-messageDialog-actions .oo-ui-flaggedElement-progressive' );
if ( startEditbutton.elementId ) {
startEditbutton.click();
}

// fill out form
$( '#wpTextbox1' ).waitForDisplayed();
$( '#wpTextbox1' ).setValue( content );
$( '#wpSave' ).click();
browser.pause( 1 * 1000 );

// save page
browser.execute( function () {
$( '#editform.mw-editform' ).submit();
}, this );

browser.pause( 2 * 1000 );

$( '#bodyContent' ).waitForDisplayed();
return $( '#bodyContent' ).getText();
} );
Expand Down
1 change: 1 addition & 0 deletions Docker/test/selenium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"test:repo-client": "wdio wdio.conf.js --spec specs/repo-client/*",
"test:fedprops": "wdio wdio.conf.js --spec specs/federated-properties/*",
"test:quickstatements": "wdio wdio.conf.js --spec specs/quickstatements/*",
"test:pingback": "wdio wdio.conf.js --spec specs/pingback/*",
"lint": "npx eslint .",
"fix": "npx eslint . --fix"
},
Expand Down
6 changes: 4 additions & 2 deletions Docker/test/selenium/specs/federated-properties/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ describe( 'Fed props Item', function () {
browser.call( () => WikibaseApi.createItem( Util.getTestString( itemLabel ), data ) );

browser.url( process.env.MW_SERVER + '/wiki/Item:' + itemId );
$( '.wikibase-statementgroupview-property' ).getText().includes( propertyValue ); // value is the label
$( '.wikibase-snakview-value-container' ).getText().includes( propertyValue );

const actualPropertyValue = $( '.wikibase-statementgroupview-property' ).getText();
assert( actualPropertyValue.includes( propertyValue ) ); // value is the label

$( '.wikibase-toolbarbutton.wikibase-toolbar-item.wikibase-toolbar-button.wikibase-toolbar-button-add' ).waitForDisplayed();
} );

Expand Down
Loading