firq-dev-website/.forgejo/workflows/unlighthouse.yml

92 lines
3 KiB
YAML
Raw Permalink Normal View History

2024-10-26 15:37:35 +00:00
name: Run unlighthouse-tests [Downstream pipeline]
run-name: Run unlighthouse-tests [Downstream pipeline] for version ${{ inputs.containertag }}
2023-12-20 23:55:41 +00:00
on:
2024-10-22 17:29:01 +00:00
workflow_dispatch:
inputs:
2024-10-22 17:44:24 +00:00
containertag:
2024-10-22 17:29:01 +00:00
description: "Tag of the container to test"
default: "preview"
type: "string"
2023-12-20 23:55:41 +00:00
jobs:
unlighthouse:
2024-10-22 15:55:25 +00:00
runs-on: docker
2024-10-22 16:37:13 +00:00
container:
image: forgejo.neshweb.net/ci-docker-images/unlighthouse:0.3.0
2024-10-22 15:15:09 +00:00
services:
2024-10-22 15:33:08 +00:00
website:
2024-10-22 17:54:26 +00:00
image: forgejo.neshweb.net/firq/firq-dev-website:${{ inputs.containertag }}
2024-10-22 15:54:37 +00:00
options: >-
2024-10-22 16:45:12 +00:00
--workdir /
2023-12-21 01:03:47 +00:00
steps:
- name: Checkout repository
uses: https://code.forgejo.org/actions/checkout@v3
2024-10-22 20:58:43 +00:00
- name: Check availability
2024-11-01 14:43:20 +00:00
run: |
while [ "$(curl -o /dev/null -s -w '%{http_code}' http://localhost:8081/)" -ne 200 ];
do echo "Waiting...";
sleep 5;
done;
2023-12-20 23:55:41 +00:00
- name: Run unlighthouse
2024-10-22 18:53:09 +00:00
run: unlighthouse-ci --site "http://localhost:8081/"
2024-10-22 20:12:02 +00:00
- name: Replace URLs
run: find ./unlighthouse-reports -type f | xargs sed -i "s|http://localhost:8081|https://preview.firq.dev|g";
- name: Prepare artifacts
run: cp serve.json unlighthouse-reports
2023-12-20 23:55:41 +00:00
- name: Upload reports
uses: actions/upload-artifact@v3
with:
name: unlighthouse-reports
2023-12-20 23:57:26 +00:00
path: unlighthouse-reports/
2024-11-01 15:17:38 +00:00
- name: Upload Dockerfile
uses: actions/upload-artifact@v3
with:
name: dockerfile
path: Dockerfile.reports
2024-11-01 14:43:20 +00:00
build-site:
needs: [ unlighthouse ]
2024-01-10 10:45:42 +00:00
if: success()
2024-11-01 14:43:20 +00:00
runs-on: dind
steps:
2024-11-01 15:17:38 +00:00
- name: Downloading static site artifacts
uses: actions/download-artifact@v3
with:
name: dockerfile
- name: Downloading static site artifacts
uses: actions/download-artifact@v3
with:
2023-12-21 11:20:39 +00:00
name: unlighthouse-reports
2024-11-01 14:59:40 +00:00
path: reports
2024-11-01 14:43:20 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Package Registry
uses: docker/login-action@v3
with:
2024-11-01 14:43:20 +00:00
registry: forgejo.neshweb.net
username: ${{ secrets.FORGEJO_USERNAME }}
password: ${{ secrets.FORGEJO_TOKEN }}
- name: Build and push to Docker Package Registry
uses: docker/build-push-action@v5
with:
2024-11-01 15:05:41 +00:00
context: .
2024-11-01 14:43:20 +00:00
file: Dockerfile.reports
push: true
tags: forgejo.neshweb.net/firq/firq-dev-website-unlighthouse:latest
2024-11-01 14:43:20 +00:00
auto-deploy-dockge:
needs: [ build-site ]
2024-01-10 10:45:42 +00:00
if: success()
runs-on: docker
2024-11-01 14:43:20 +00:00
container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
steps:
2024-11-01 14:43:20 +00:00
- name: Configure Dockge CLI
run: |
2024-11-01 14:43:20 +00:00
dockge host '${{ vars.DOCKGE_HOST }}'
dockge login --user '${{ secrets.DOCKGE_USER }}' --password '${{ secrets.DOCKGE_CREDENTIAL }}'
- name: Check status and redeploy
run: |
dockge status firq-dev-unlighthouse
dockge update firq-dev-unlighthouse
dockge status firq-dev-unlighthouse