T351720 GH actions based release automation #1174
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🏗️🧪 Build and Test | |
on: | |
push: | |
branches: | |
- "main" | |
- "mw-*" | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
- '**/*.txt' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint | |
run: ./lint.sh | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
component: | |
[ | |
"wikibase", | |
"elasticsearch", | |
"wdqs", | |
"wdqs-frontend", | |
"wdqs-proxy", | |
"quickstatements", | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build | |
with: | |
component: ${{ matrix.component }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
suite: | |
[ | |
repo, | |
fedprops, | |
repo_client, | |
quickstatements, | |
pingback, | |
confirm_edit, | |
elasticsearch, | |
base__repo, | |
base__repo_client, | |
base__pingback, | |
base__fedprops, | |
example | |
] | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get built Docker artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: DockerImages | |
path: artifacts/ | |
- name: Test ${{ matrix.suite }} | |
run: ./test.sh ${{ matrix.suite }} | |
- name: Report Selenium | |
if: always() | |
run: | | |
cd .github/reporter | |
npm install | |
node report.js ${{ matrix.suite }} | |
- name: Show Logs | |
if: always() | |
continue-on-error: true | |
run: | | |
ls -lahr test/suites/${{ matrix.suite }}/results test/suites/${{ matrix.suite }}/results/* | |
tail -n +1 test/suites/${{ matrix.suite }}/results/*.log | |
- name: Archive Docker test artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: TestResults | |
path: test/suites/**/results | |
test_upgrade: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
# TODO: can we get this from the environment to not have it hardcoded in the pipeline code? | |
version: [ | |
# Latest 1.37 | |
'WMDE9', | |
'WMDE9_BUNDLE', | |
# Latest 1.38 | |
'WMDE12', | |
'WMDE12_BUNDLE', | |
# Latest 1.39 | |
'WMDE13', | |
'WMDE13_BUNDLE' | |
] | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get built Docker artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: DockerImages | |
path: artifacts/ | |
- name: Test upgrade from ${{ matrix.version }} | |
# This step should only take ~5 mins to complete, but sometimes seems to lock up and use the whole job timeout | |
# Set a specific lower timeout to allow us to retry sooner | |
timeout-minutes: 10 | |
run: ./test.sh upgrade ${{ matrix.version }} | |
# TODO: DRY | |
- name: Archive Docker test artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: TestResults | |
path: test/suites/**/results | |
upload_ghcr: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
# we only upload builds to github container registry | |
# - from main branch builds | |
# - from release branch builds and | |
# - builds from PRs going to a release branch | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/mw-') || startsWith(github.base_ref, 'mw-') | |
needs: | |
- test | |
- test_upgrade | |
strategy: | |
fail-fast: false | |
matrix: | |
docker_image: | |
[ | |
"wikibase/wikibase", | |
"wikibase/wikibase-bundle", | |
"wikibase/elasticsearch", | |
"wikibase/wdqs", | |
"wikibase/wdqs-frontend", | |
"wikibase/wdqs-proxy", | |
"wikibase/quickstatements", | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get built Docker images | |
uses: actions/download-artifact@v3 | |
with: | |
name: DockerImages | |
path: artifacts/ | |
- name: Load docker images | |
shell: bash | |
run: | | |
for file in artifacts/*.docker.tar.gz; do | |
docker load -i "$file" | |
done | |
- uses: ./.github/actions/push-ghcr | |
with: | |
component: ${{ matrix.component }} |