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

T350879 item properties #519

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: c-py/action-dotenv-to-setenv@v4
- uses: c-py/action-dotenv-to-setenv@v5
with:
env-file: "variables.env"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: c-py/action-dotenv-to-setenv@v4
- uses: c-py/action-dotenv-to-setenv@v5
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
- uses: c-py/action-dotenv-to-setenv@v5
with:
env-file: ${{ env.env_file }}
- name: run the publish script
Expand Down
2 changes: 1 addition & 1 deletion Docker/publish/upload_tar/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ -z "$RELEASE_HOST" ] || \
exit 1;
fi

ARTIFACT_PATH=/extractedArtifacts/BuildArtifacts
ARTIFACT_PATH=/extractedArtifacts/TarBalls
RELEASE_FULL_PATH=$RELEASE_DIR/$RELEASE_MAJOR_VERSION

# Setup ssh-keys
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Remove locally created artifacts and use the downloaded ones

```
$ make clean
$ cp artifacts/WORKFLOW_RUN_NUMBER/BuildArtifacts/* artifacts/
$ cp artifacts/WORKFLOW_RUN_NUMBER/DockerImages/* artifacts/
$ make test SUITE=<suite-name>
```

Expand Down
8 changes: 4 additions & 4 deletions docs/topics/test-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ sudo docker compose -f docker-compose.yml -f docker-compose.extra.yml start wdqs

The service should now be up and running!

## Using images from BuildArtifacts
## Using images from built artifacts

You load images from tar files that are part of `BuildArtifacts` for any Github run.
You load images from tar files that are in `DockerImages` for any Github run.

Firstly, find the run summary that you want to load, such as https://github.com/wmde/wikibase-release-pipeline/actions/runs/3446873839.

When authenticated using the `gh` CLI tool, you can download `BuildArtifacts` of any run using the run ID.
When authenticated using the `gh` CLI tool, you can download `DockerImages` of any run using the run ID.

```sh
gh run download 3446873839 -n BuildArtifacts -R wmde/wikibase-release-pipeline
gh run download 3446873839 -n DockerImages -R wmde/wikibase-release-pipeline
```

Once downloaded you can load the compressed images and delete the artifacts from disk in a quick loop.
Expand Down
14 changes: 7 additions & 7 deletions publish/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ services:
dockerfile: Dockerfile
privileged: true
environment:
- ELASTICSEARCH_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/elasticsearch.docker.tar.gz
- WIKIBASE_BUNDLE_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/wikibase-bundle.docker.tar.gz
- WIKIBASE_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/wikibase.docker.tar.gz
- WDQS_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/wdqs.docker.tar.gz
- WDQS_FRONTEND_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/wdqs-frontend.docker.tar.gz
- QUICKSTATEMENTS_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/quickstatements.docker.tar.gz
- WDQS_PROXY_DOCKER_PATH=/extractedArtifacts/BuildArtifacts/wdqs-proxy.docker.tar.gz
- ELASTICSEARCH_DOCKER_PATH=/extractedArtifacts/DockerImages/elasticsearch.docker.tar.gz
- WIKIBASE_BUNDLE_DOCKER_PATH=/extractedArtifacts/DockerImages/wikibase-bundle.docker.tar.gz
- WIKIBASE_DOCKER_PATH=/extractedArtifacts/DockerImages/wikibase.docker.tar.gz
- WDQS_DOCKER_PATH=/extractedArtifacts/DockerImages/wdqs.docker.tar.gz
- WDQS_FRONTEND_DOCKER_PATH=/extractedArtifacts/DockerImages/wdqs-frontend.docker.tar.gz
- QUICKSTATEMENTS_DOCKER_PATH=/extractedArtifacts/DockerImages/quickstatements.docker.tar.gz
- WDQS_PROXY_DOCKER_PATH=/extractedArtifacts/DockerImages/wdqs-proxy.docker.tar.gz

- WDQS_IMAGE_NAME
- WDQS_FRONTEND_IMAGE_NAME
Expand Down
2 changes: 1 addition & 1 deletion publish/tar-nodocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -z "$RELEASE_HOST" ] || \
exit 1;
fi

ARTIFACT_PATH=./artifacts/$WORKFLOW_RUN_NUMBER/BuildArtifacts
ARTIFACT_PATH=./artifacts/$WORKFLOW_RUN_NUMBER/TarBalls
RELEASE_FULL_PATH=$RELEASE_DIR/$RELEASE_MAJOR_VERSION

echo "Will upload tarballs from $ARTIFACT_PATH to $RELEASE_HOST at $RELEASE_FULL_PATH"
Expand Down
6 changes: 6 additions & 0 deletions test/helpers/default-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function defaultFunctions(): void {
}

return new Promise( ( resolve ) => {
// eslint-disable-next-line security/detect-child-process
exec( fullCommand, ( error, stdout, stderr ) => {
if ( error ) {
console.warn( error );
Expand All @@ -132,6 +133,7 @@ export function defaultFunctions(): void {
await browser.url( `${host}/wiki/${title}?action=edit` );

// wait for javascript to settle
// eslint-disable-next-line wdio/no-pause
await browser.pause( 5 * 1000 );

// this shows up one time for anonymous users (VisualEditor)
Expand All @@ -142,6 +144,7 @@ export function defaultFunctions(): void {
await startEditbutton.click();

// wait for fade out animation to finish
// eslint-disable-next-line wdio/no-pause
await browser.pause( 2 * 1000 );
}

Expand All @@ -155,6 +158,7 @@ export function defaultFunctions(): void {
// save page
await browser.execute( async () => $( '#editform.mw-editform' ).submit() );

// eslint-disable-next-line wdio/no-pause
await browser.pause( 2 * 1000 );

return await $( '#mw-content-text' ).getText();
Expand Down Expand Up @@ -223,11 +227,13 @@ export function defaultFunctions(): void {
// create a batch
await $( '.create_batch_box textarea' ).setValue( theQuery );

// eslint-disable-next-line wdio/no-pause
await browser.pause( 1000 );

// click import
await $( "button[tt='dialog_import_v1']" ).click();

// eslint-disable-next-line wdio/no-pause
await browser.pause( 1000 );

// click run
Expand Down
3 changes: 3 additions & 0 deletions test/helpers/json-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class JsonReporter extends WDIOReporter {
}
};

// eslint-disable-next-line security/detect-non-literal-fs-filename
if ( existsSync( this.resultFilePath ) ) {
const existing: ResultType = JSON.parse(
// eslint-disable-next-line security/detect-non-literal-fs-filename
readFileSync( this.resultFilePath, 'utf8' )
);

Expand All @@ -60,6 +62,7 @@ class JsonReporter extends WDIOReporter {
}
}

// eslint-disable-next-line security/detect-non-literal-fs-filename
writeFileSync(
this.resultFilePath,
JSON.stringify( result, null, 2 ),
Expand Down
1 change: 1 addition & 0 deletions test/helpers/pages/queryservice-ui/queryservice-ui.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class QueryServiceUI extends SubmittablePage {
return text.includes( prop );
}

// eslint-disable-next-line security/detect-non-literal-regexp
const regexp = new RegExp( `(${prop})(\\s+)(${value})` );
const matches = text.match( regexp );
return matches !== null;
Expand Down
21 changes: 21 additions & 0 deletions test/helpers/types/request-response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type DataValue = {
value: string;
type: 'string';
};
export type Reference = {
datavalue: DataValue;
};
export type Claim = {
mainsnak: {
datavalue: DataValue;
};
references: {
snaks: Record<string, Reference[]>;
}[];
};
type Entity = {
claims: Record<string, Claim[]>;
};
export type SpecialEntityData = {
entities: Record<string, Entity>;
};
6 changes: 6 additions & 0 deletions test/helpers/types/wikibase-property-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type WikibasePropertyType = {
name: string;
urlName: string;
};

export default WikibasePropertyType;
25 changes: 25 additions & 0 deletions test/helpers/wikibase-property-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import WikibasePropertyType from './types/wikibase-property-type.js';

export const wikibasePropertyItem: WikibasePropertyType = {
name: 'Item',
urlName: 'wikibase-item'
};
export const wikibasePropertyString: WikibasePropertyType = {
name: 'String',
urlName: 'string'
};

// OTHER TYPES:
// 'Commons media file',
// 'EDTF Date/Time',
// 'Entity Schema',
// 'External identifier',
// 'Geographic coordinates',
// 'Geographic shape',
// 'Media file',
// 'Monolingual text',
// 'Point in time',
// 'Property',
// 'Quantity',
// 'Tabular data',
// 'URL'
2 changes: 1 addition & 1 deletion test/scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

# ℹ️ Linting Dockerfiles (**/Dockerfile)
# https://github.com/hadolint/hadolint
docker run --rm -v "$(pwd)":/code -v "$(pwd)/.hadolint.yml":/.hadolint.yml hadolint/hadolint:latest-alpine sh -c "find /code -type f -name 'Dockerfile' | xargs hadolint"
docker run --rm -v "$(pwd)":/code -v "$(pwd)/.hadolint.yml":/.hadolint.yml hadolint/hadolint:latest-alpine sh -c "find . -name Dockerfile -print -o -type d -name node_modules -prune | xargs hadolint"

# ℹ️ Linting Shell Scripts (**/*.sh)
# https://github.com/koalaman/shellcheck#from-your-terminal
Expand Down
1 change: 1 addition & 0 deletions test/specs/fedprops/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe( 'Fed props Item', function () {
await QueryServiceUI.open( query, prefixes );

// wait for WDQS-updater
// eslint-disable-next-line wdio/no-pause
await browser.pause( 11 * 1000 );

await QueryServiceUI.submit();
Expand Down
1 change: 1 addition & 0 deletions test/specs/fedprops/prefetching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe( 'Property Prefetching', function () {
}

// Sleep for 2 seconds to ensure post edit things run
// eslint-disable-next-line wdio/no-pause
await browser.pause( 2000 );
} );

Expand Down
1 change: 1 addition & 0 deletions test/specs/pingback/pingback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe( 'Pingback', function () {
it( 'Should ping on first page request', async () => {
await browser.url( process.env.MW_SERVER + '/wiki/Main_Page' );

// eslint-disable-next-line wdio/no-pause
await browser.pause( 5 * 1000 );

const sqlResult = await browser.dbQuery(
Expand Down
1 change: 1 addition & 0 deletions test/specs/quickstatements/quickstatements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe( 'QuickStatements Service', function () {
await $( '#mw-mwoauth-authorize-form' );
await $( '#mw-mwoauth-accept' ).click();

// eslint-disable-next-line wdio/no-pause
await browser.pause( 2 * 1000 );

// redirect back to app
Expand Down
1 change: 1 addition & 0 deletions test/specs/repo/extensions/entityschema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe( 'EntitySchema', function () {

// set template
const shexTemplate = (
// eslint-disable-next-line security/detect-non-literal-fs-filename
await readFile( new URL( 'entityschema.sx', import.meta.url ), utf8 )
)
.toString()
Expand Down
1 change: 1 addition & 0 deletions test/specs/repo/extensions/scribunto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe( 'Scribunto', function () {
} );

it( 'Should be able to execute lua module', async () => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
const fileContents = await readFile( new URL( 'bananas.lua', import.meta.url ), utf8 );
await browser.editPage(
process.env.MW_SERVER,
Expand Down
1 change: 1 addition & 0 deletions test/specs/repo/extensions/syntax-highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe( 'SyntaxHighlight', function () {
} );

it( 'Should highlight lua script', async () => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
const fileContents = await readFile( new URL( 'bananas.lua', import.meta.url ), utf8 );

await browser.editPage(
Expand Down
1 change: 1 addition & 0 deletions test/specs/repo/extensions/visual-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe( 'VisualEditor', function () {
const messageDialogAEl = await $$( '.oo-ui-messageDialog-actions a' );
await messageDialogAEl[ 1 ].click();

// eslint-disable-next-line wdio/no-pause
await browser.pause( 5 * 1000 );

// disable notice popup and focus on editor
Expand Down
Loading