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