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

Update extension test workflow on REL1_42 branch #770

Open
wants to merge 3 commits into
base: REL1_42
Choose a base branch
from
Open
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
141 changes: 106 additions & 35 deletions .github/workflows/extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ on:
env:
DOCKER_REGISTRY: docker-registry.wikimedia.org
DOCKER_ORG: releng
QUIBBLE_DOCKER_IMAGE: quibble-buster-php74
# There is no quibble-buster-php74-coverage yet
COVERAGE_DOCKER_IMAGE: quibble-buster-php73-coverage
PHAN_DOCKER_IMAGE: mediawiki-phan-php74
QUIBBLE_DOCKER_IMAGE: quibble-buster-php81
# There is no quibble-buster-php81-coverage yet
COVERAGE_DOCKER_IMAGE: quibble-buster-php74-coverage
PHAN_DOCKER_IMAGE: mediawiki-phan-php81

jobs:
test:
Expand Down Expand Up @@ -75,26 +75,19 @@ jobs:
fi
echo MEDIAWIKI_VERSION="${MEDIAWIKI_VERSION}" >> $GITHUB_ENV

if [ "${{ matrix.stage }}" == 'phan' ]; then
export DOCKER_IMAGE="${PHAN_DOCKER_IMAGE}"
elif [ "${{ matrix.stage }}" == coverage ]; then
export DOCKER_IMAGE="${COVERAGE_DOCKER_IMAGE}"
else
export DOCKER_IMAGE="${QUIBBLE_DOCKER_IMAGE}"
fi
echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> $GITHUB_ENV

# Get the latest docker tag (Ref: https://github.com/thcipriani/dockerregistry)
DOCKER_LATEST_TAG="$(curl -sL "https://${DOCKER_REGISTRY}/v2/${DOCKER_ORG}/${DOCKER_IMAGE}/tags/list" |
QUIBBLE_DOCKER_LATEST_TAG="$(curl -sL "https://${DOCKER_REGISTRY}/v2/${DOCKER_ORG}/${QUIBBLE_DOCKER_IMAGE}/tags/list" |
python3 -c 'import json;print("\n".join(json.loads(input())["tags"]))' |
grep -v latest | sort -Vr | head -1)"
echo "DOCKER_LATEST_TAG=${DOCKER_LATEST_TAG}" >> $GITHUB_ENV
echo "QUIBBLE_DOCKER_LATEST_TAG=${QUIBBLE_DOCKER_LATEST_TAG}" >> $GITHUB_ENV
if [ "${{ matrix.stage }}" == 'phan' ]; then
echo "QUIBBLE_DOCKER_LATEST_TAG=$(curl -sL "https://${DOCKER_REGISTRY}/v2/${DOCKER_ORG}/${QUIBBLE_DOCKER_IMAGE}/tags/list" |
echo "PHAN_DOCKER_LATEST_TAG=$(curl -sL "https://${DOCKER_REGISTRY}/v2/${DOCKER_ORG}/${PHAN_DOCKER_IMAGE}/tags/list" |
python3 -c 'import json;print("\n".join(json.loads(input())["tags"]))' |
grep -v latest | sort -Vr | head -1)" >> $GITHUB_ENV
elif [ "${{ matrix.stage }}" == 'coverage' ]; then
echo "QUIBBLE_DOCKER_LATEST_TAG=${DOCKER_LATEST_TAG}" >> $GITHUB_ENV
echo "COVERAGE_DOCKER_LATEST_TAG=$(curl -sL "https://${DOCKER_REGISTRY}/v2/${DOCKER_ORG}/${COVERAGE_DOCKER_IMAGE}/tags/list" |
python3 -c 'import json;print("\n".join(json.loads(input())["tags"]))' |
grep -v latest | sort -Vr | head -1)" >> $GITHUB_ENV
fi

# Resolve dependencies
Expand All @@ -105,26 +98,46 @@ jobs:
echo "DEPENDENCIES=$(python3 rd.py)" >> $GITHUB_ENV
fi

- name: Cache docker image
uses: actions/cache@v3
with:
path: /home/runner/docker-images/${{ env.DOCKER_IMAGE }}
key: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_LATEST_TAG }}
- name: Load or pull docker image
run: |
docker load -i /home/runner/docker-images/"${DOCKER_IMAGE}" || \
docker pull "${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}"
- name: Cache quibble docker image
if: ${{ matrix.stage == 'coverage' || matrix.stage == 'phan' }}
uses: actions/cache@v3
with:
path: /home/runner/docker-images/${{ env.QUIBBLE_DOCKER_IMAGE }}
key: ${{ env.QUIBBLE_DOCKER_IMAGE }}:${{ env.QUIBBLE_DOCKER_LATEST_TAG }}
- name: Load or pull quibble docker image
if: ${{ matrix.stage == 'coverage' || matrix.stage == 'phan' }}
run: |
docker load -i /home/runner/docker-images/"${QUIBBLE_DOCKER_IMAGE}" || \
if [ -f /home/runner/docker-images/"${QUIBBLE_DOCKER_IMAGE}" ]; then
docker load -i /home/runner/docker-images/"${QUIBBLE_DOCKER_IMAGE}"
else
docker pull "${DOCKER_REGISTRY}/${DOCKER_ORG}/${QUIBBLE_DOCKER_IMAGE}:${QUIBBLE_DOCKER_LATEST_TAG}"
fi
- name: Cache quibble coverage docker image
if: matrix.stage == 'coverage'
uses: actions/cache@v3
with:
path: /home/runner/docker-images/${{ env.COVERAGE_DOCKER_IMAGE }}
key: ${{ env.COVERAGE_DOCKER_IMAGE }}:${{ env.COVERAGE_DOCKER_LATEST_TAG }}
- name: Cache phan docker image
if: matrix.stage == 'phan'
uses: actions/cache@v3
with:
path: /home/runner/docker-images/${{ env.PHAN_DOCKER_IMAGE }}
key: ${{ env.PHAN_DOCKER_IMAGE }}:${{ env.PHAN_DOCKER_LATEST_TAG }}
- name: Load or pull quibble coverage docker image
if: matrix.stage == 'coverage'
run: |
if [ -f /home/runner/docker-images/"${COVERAGE_DOCKER_IMAGE}" ]; then
docker load -i /home/runner/docker-images/"${COVERAGE_DOCKER_IMAGE}"
else
docker pull "${DOCKER_REGISTRY}/${DOCKER_ORG}/${COVERAGE_DOCKER_IMAGE}:${COVERAGE_DOCKER_LATEST_TAG}"
fi
- name: Load or pull phan docker image
if: matrix.stage == 'phan'
run: |
if [ -f /home/runner/docker-images/"${PHAN_DOCKER_IMAGE}" ]; then
docker load -i /home/runner/docker-images/"${PHAN_DOCKER_IMAGE}"
else
docker pull "${DOCKER_REGISTRY}/${DOCKER_ORG}/${PHAN_DOCKER_IMAGE}:${PHAN_DOCKER_LATEST_TAG}"
fi

- name: Cache MediaWiki installation
uses: actions/cache@v3
Expand All @@ -138,7 +151,57 @@ jobs:
git clone -b "${MEDIAWIKI_VERSION}" --depth 1 https://gerrit.wikimedia.org/r/mediawiki/core src
git clone --recurse-submodules -b "${MEDIAWIKI_VERSION}" --depth 1 https://gerrit.wikimedia.org/r/mediawiki/skins/Vector src/skins/Vector
for dep in $DEPENDENCIES; do
git clone --recurse-submodules -b "${MEDIAWIKI_VERSION}" --depth 1 "https://gerrit.wikimedia.org/r/${dep}" src/"$(echo $dep | cut -d'/' -f2,3)"
if [ "$dep" = 'mediawiki/extensions/Wikibase' ]; then
git clone -b "${MEDIAWIKI_VERSION}" --depth 1 "https://gerrit.wikimedia.org/r/${dep}" src/"$(echo $dep | cut -d'/' -f2,3)"

cd src/"$(echo $dep | cut -d'/' -f2,3)"
# https://gerrit.wikimedia.org/r/q/I2037cd8bb5d568021472e048900649028b5dcc62
git apply << 'EOF'
diff --git a/.gitmodules b/.gitmodules
index df41c768af..e9926d6ddd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -3,13 +3,13 @@
url = https://gerrit.wikimedia.org/r/data-values/value-view
[submodule "view/lib/wikibase-serialization"]
path = view/lib/wikibase-serialization
- url = https://phabricator.wikimedia.org/source/wikibase-serialization.git
+ url = https://github.com/wmde/WikibaseSerializationJavaScript.git
[submodule "view/lib/wikibase-data-values"]
path = view/lib/wikibase-data-values
- url = https://phabricator.wikimedia.org/source/datavalues-javascript.git
+ url = https://github.com/wmde/DataValuesJavaScript.git
[submodule "view/lib/wikibase-data-model"]
path = view/lib/wikibase-data-model
- url = https://phabricator.wikimedia.org/source/wikibase-data-model.git
+ url = https://github.com/wmde/WikibaseDataModelJavaScript.git
[submodule "view/lib/wikibase-termbox"]
path = view/lib/wikibase-termbox
url = https://gerrit.wikimedia.org/r/wikibase/termbox
EOF
git submodule update --init
cd -
elif [ "$dep" = 'mediawiki/extensions/WikibaseLexeme' ]; then
git clone -b "${MEDIAWIKI_VERSION}" --depth 1 "https://gerrit.wikimedia.org/r/${dep}" src/"$(echo $dep | cut -d'/' -f2,3)"

cd src/"$(echo $dep | cut -d'/' -f2,3)"
# https://gerrit.wikimedia.org/r/q/I2037cd8bb5d568021472e048900649028b5dcc62
git apply << 'EOF'
diff --git a/.gitmodules b/.gitmodules
index 51ab4cd..97dff70 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "resources/special/new-lexeme"]
path = resources/special/new-lexeme
- url = https://phabricator.wikimedia.org/diffusion/NLSP/new-lexeme-special-page.git
+ url = https://github.com/wmde/new-lexeme-special-page.git
EOF
git submodule update --init
cd -
else
git clone --recurse-submodules -b "${MEDIAWIKI_VERSION}" --depth 1 "https://gerrit.wikimedia.org/r/${dep}" src/"$(echo $dep | cut -d'/' -f2,3)"
fi
done
fi
git -C src/ log -n 1 --format="%H"
Expand Down Expand Up @@ -198,7 +261,7 @@ jobs:
docker run \
-e "THING_SUBNAME=${{ env.TYPE }}s/${{ env.EXTENSION_NAME }}" \
-v "$(pwd)"/src:/mediawiki \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${PHAN_DOCKER_IMAGE}:${PHAN_DOCKER_LATEST_TAG}" \
--color
elif [ "${{ matrix.stage }}" == 'coverage' ]; then
if [ -d tests/phpunit ]; then
Expand All @@ -215,7 +278,7 @@ jobs:
-v "$(pwd)"/cache:/cache \
-v "$(pwd)"/src:/workspace/src \
-v "$(pwd)"/cover:/workspace/cover \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${COVERAGE_DOCKER_IMAGE}:${COVERAGE_DOCKER_LATEST_TAG}" \
--skip-zuul \
--skip-deps \
-c "${COMMEND}"
Expand All @@ -227,7 +290,7 @@ jobs:
-e "ZUUL_PROJECT=mediawiki/${{ env.TYPE }}s/${{ env.EXTENSION_NAME }}" \
-v "$(pwd)"/cache:/cache \
-v "$(pwd)"/src:/workspace/src \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${QUIBBLE_DOCKER_IMAGE}:${QUIBBLE_DOCKER_LATEST_TAG}" \
--skip-zuul \
--packages-source composer \
--run "${{ matrix.stage }}" \
Expand All @@ -247,5 +310,13 @@ jobs:
# See https://doc.wikimedia.org/quibble/index.html#remove-localsettings-php-between-runs
rm "$(pwd)"/src/LocalSettings.php || true
mkdir -p docker-images
docker save -o "$(pwd)/docker-images/${DOCKER_IMAGE}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}"

docker save -o "$(pwd)/docker-images/${QUIBBLE_DOCKER_IMAGE}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${QUIBBLE_DOCKER_IMAGE}:${QUIBBLE_DOCKER_LATEST_TAG}"
if [ -n "$PHAN_DOCKER_LATEST_TAG" ]; then
docker save -o "$(pwd)/docker-images/${PHAN_DOCKER_IMAGE}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${PHAN_DOCKER_IMAGE}:${PHAN_DOCKER_LATEST_TAG}"
elif [ -n "$COVERAGE_DOCKER_LATEST_TAG" ]; then
docker save -o "$(pwd)/docker-images/${COVERAGE_DOCKER_IMAGE}" \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${COVERAGE_DOCKER_IMAGE}:${COVERAGE_DOCKER_LATEST_TAG}"
fi
6 changes: 3 additions & 3 deletions .github/workflows/release-and-submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ name: Upload Release Asset and submit a PR to docker-mediawiki repository

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '7.3'
tools: composer:v1

- uses: actions/setup-node@v3
Expand All @@ -30,7 +30,7 @@ jobs:

- name: Set tag name
id: tag_name
run: echo "tag_name=$(basename ${{ github.ref }})" >> $GITHUB_OUTPUT
run: echo "::set-output name=tag_name::$(basename ${{ github.ref }})"
- name: Build project
run: |
composer update --no-dev
Expand Down
Loading