fw: Lockdown history excepts users #272
Workflow file for this run
This file contains hidden or 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: 'Docker: femiwiki' | |
| on: | |
| push: | |
| paths: | |
| - 'dockers/femiwiki/**' | |
| - .github/workflows/docker-femiwiki.yml | |
| pull_request: | |
| paths: | |
| - 'dockers/femiwiki/**' | |
| - .github/workflows/docker-femiwiki.yml | |
| workflow_dispatch: | |
| concurrency: | |
| group: docker-femiwiki | |
| cancel-in-progress: ${{ github.ref == 'refs/heads/main' }} | |
| 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 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~' 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 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: | | |
| URL="127.0.0.1:8080" | |
| curl -Lv "$URL" && echo "main success" || echo "main failure" | |
| 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" | |
| - name: backup of failure - docker status | |
| if: ${{ failure() }} | |
| run: | | |
| docker ps; | |
| for s in $(docker service ls -q ); do docker service ps "$s"; done | |
| docker container ps; | |
| - name: backup of failure - docker logs | |
| if: ${{ failure() }} | |
| run: | | |
| 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 }} |