Skip to content

femiwiki: Use luaSandbox (#861) #80

femiwiki: Use luaSandbox (#861)

femiwiki: Use luaSandbox (#861) #80

name: 'Docker: femiwiki'
on:
push:
paths:
- 'dockers/femiwiki/**'
- .github/workflows/docker-femiwiki.yml
pull_request:
paths:
- 'dockers/femiwiki/**'
- .github/workflows/docker-femiwiki.yml
workflow_dispatch:
jobs:
docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Edit configuration
run: |
mv development/secret.php.example development/secret.php
mv dockers/femiwiki/LocalSettings.php development
mv dockers/femiwiki/Hotfix.php development
sed -i -r 's~ghcr\.io\/femiwiki\/femiwiki:.+~ghcr\.io\/femiwiki\/femiwiki:docker-test~' docker-compose.yml
- run: |
echo "version=$(date +%Y-%m-%dT%H-%M)-$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_OUTPUT
id: version
- uses: docker/build-push-action@v6
with:
context: '{{ defaultContext }}:dockers/femiwiki'
platforms: linux/amd64
cache-from: ghcr.io/femiwiki/femiwiki:latest
cache-to: mode=max,type=local,dest=/tmp/.buildx-cache
load: true
push: false
tags: ghcr.io/femiwiki/femiwiki:docker-test
- name: Initialize docker swarm and start services
run: |
docker swarm init
docker stack deploy -c docker-compose.yml mediawiki
- name: Access 127.0.0.1:8080 until success
timeout-minutes: 2
run: |
echo 'Waiting for http...'
until curl -sLfo /dev/null 127.0.0.1:8080; do
sleep 1; done
- name: Test VisualEditor API
run: |
URL="127.0.0.1:8080/api.php?action=visualeditor&format=json&page=arbitrary_page&paction=parse&wikitext=arbitrary"
curl -sLfo /dev/null "$URL"
- name: Test Extension:Math
timeout-minutes: 1
run: |
URL="127.0.0.1:8080/w/Special:MathStatus"
until curl -sLfo /dev/null "$URL"; do
sleep 1; done
- name: backup of failure
if: ${{ failure() }}
timeout-minutes: 1
run: |
echo 'Failed to connect to 127.0.0.1:8080'
URL="127.0.0.1:8080/api.php?action=visualeditor&format=json&page=arbitrary_page&paction=parse&wikitext=arbitrary"
curl -Lv "$URL" && echo "VE success" || echo "VE failure"
URL="127.0.0.1:8080/w/Special:MathStatus"
curl -Lv "$URL" && echo "Math success" || echo "Math failure"
docker ps;
for s in $(docker service ls -q ); do docker service ps "$s"; done
docker container ps;
for s in $(docker service ls -q ); do docker service logs "$s"; done
- name: Check if the container is still up
run: test "$(docker service ps -qf 'desired-state=Running' -f 'desired-state=Ready' mediawiki_fastcgi)"
- name: Try to access the mediawiki
run: curl -sSLvo /dev/null 127.0.0.1:8080 || docker service logs mediawiki_fastcgi
- uses: docker/login-action@v3
if: github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build a multi-platform docker image and push
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}:dockers/femiwiki'
platforms: linux/amd64,linux/arm64
cache-from: |
ghcr.io/femiwiki/femiwiki:latest
type=local,src=/tmp/.buildx-cache
cache-to: mode=max,type=inline
load: false
push: ${{ github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/femiwiki/femiwiki:latest
ghcr.io/femiwiki/femiwiki:${{ steps.version.outputs.version }}
- name: Submit a PR to our nomad repository
if: github.repository_owner == 'femiwiki' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
gh workflow run -R femiwiki/nomad bump-mediawiki.yml \
-f tag=${{ steps.version.outputs.version }}