Firq
b0fc3a05c5
All checks were successful
Linting and checking code / get-version (push) Successful in 2s
Linting and checking code / astro-check (push) Successful in 12s
Build and deploy preview site / check-tag (push) Successful in 2s
Build and deploy preview site / checking (push) Successful in 12s
Build and deploy preview site / build-site (push) Successful in 1m11s
Build and deploy preview site / run-unlighthouse (push) Successful in 0s
Build and deploy preview site / auto-deploy-dockge (push) Successful in 3s
Build and deploy preview site / create-release (push) Successful in 5s
112 lines
4.2 KiB
YAML
112 lines
4.2 KiB
YAML
name: Run unlighthouse-tests [Downstream pipeline]
|
|
run-name: Run unlighthouse-tests [Downstream pipeline] for version ${{ inputs.containertag }}
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
containertag:
|
|
description: "Tag of the container to test"
|
|
default: "preview"
|
|
type: "string"
|
|
|
|
jobs:
|
|
unlighthouse:
|
|
runs-on: docker
|
|
container:
|
|
image: forgejo.neshweb.net/ci-docker-images/unlighthouse:0.3.0
|
|
services:
|
|
website:
|
|
image: forgejo.neshweb.net/firq/firq-dev-website:${{ inputs.containertag }}
|
|
options: >-
|
|
--workdir /
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: https://code.forgejo.org/actions/checkout@v3
|
|
- name: Check availability
|
|
run: curl "http://localhost:8081/"
|
|
- name: Run unlighthouse
|
|
run: unlighthouse-ci --site "http://localhost:8081/"
|
|
- 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
|
|
- name: Upload reports
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: unlighthouse-reports
|
|
path: unlighthouse-reports/
|
|
|
|
deploy-unlighthouse-files:
|
|
needs: [ unlighthouse ]
|
|
if: success()
|
|
runs-on: docker
|
|
env:
|
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
steps:
|
|
- name: Install and update ssh + rsync
|
|
run: |
|
|
which rsync || ( apt update -y && apt install rsync -y)
|
|
which ssh-agent || ( apt update -y && apt install openssh-client -y)
|
|
- name: Downloading static site artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: unlighthouse-reports
|
|
path: public
|
|
- name: Install SSH Key
|
|
uses: https://github.com/shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
known_hosts: unnecessary
|
|
- name: Adding Known Hosts
|
|
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
|
- name: Stop screen session, delete old files
|
|
uses: https://github.com/appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ env.DEPLOY_HOST }}
|
|
username: ${{ env.DEPLOY_USER }}
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
script: |
|
|
screen -X -S firq_dev-unlighthouse kill
|
|
rm -r -f firq_dev/unlighthouse/*
|
|
- name: Copy files using rsync
|
|
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/firq_dev/unlighthouse
|
|
- name: Check files on deploy target
|
|
uses: https://github.com/appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ env.DEPLOY_HOST }}
|
|
username: ${{ env.DEPLOY_USER }}
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
script: |
|
|
cd firq_dev
|
|
find unlighthouse -maxdepth 1 -printf "%p\n"
|
|
|
|
deploy-unlighthouse-site:
|
|
needs: [ deploy-unlighthouse-files ]
|
|
if: success()
|
|
runs-on: docker
|
|
env:
|
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
steps:
|
|
- name: Install and update ssh + rsync
|
|
run: |
|
|
which rsync || ( apt update -y && apt install rsync -y)
|
|
which ssh-agent || ( apt update -y && apt install openssh-client -y)
|
|
- name: Install SSH Key
|
|
uses: https://github.com/shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
known_hosts: unnecessary
|
|
- name: Adding Known Hosts
|
|
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
|
- name: Start new screen session
|
|
uses: https://github.com/appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ env.DEPLOY_HOST }}
|
|
username: ${{ env.DEPLOY_USER }}
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
script: |
|
|
PATH="$HOME/.local/bin:$PATH"
|
|
screen -ls | grep 'firq_dev-unlighthouse' | awk '{print $1}' | xargs -I % -t screen -X -S % quit
|
|
cd firq_dev
|
|
screen -S firq_dev-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }}
|