Skip to content

Reader modernization step 2 #4134

Reader modernization step 2

Reader modernization step 2 #4134

on:
push:
pull_request:
workflow_dispatch:
inputs:
integration_test_repository:
description: 'Integration testing repository path'
required: true
default: 'psilabs-dev/aio-lanraragi'
integration_test_ref:
description: 'Integration testing repository git commit hash or branch'
required: true
default: '64b12b317ed85e6f1185328f6a0e3ca4b34cab87'
env:
INTEGRATION_TEST_REPOSITORY: ${{ github.event.inputs.integration_test_repository || 'psilabs-dev/aio-lanraragi' }}
INTEGRATION_TEST_REF: ${{ github.event.inputs.integration_test_ref || '64b12b317ed85e6f1185328f6a0e3ca4b34cab87' }}
name: "Continuous Integration \U0001F44C\U0001F440"
jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
- run: npm ci
- run: npm run lint
testSuite:
name: Run Test Suite and Perl Critic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build LRR Docker image
uses: docker/build-push-action@v7
with:
file: ./tools/build/docker/Dockerfile
tags: lanraragi:test
outputs: type=docker
cache-from: type=gha,scope=buildkit-linux-amd64
- name: Copy tests
run: cp -R tests .github/action-run-tests
- name: LANraragi Test Suite
uses: ./.github/action-run-tests
- name: Perl Critic
uses: Difegue/action-perlcritic@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: ./lib/* ./script/* ./tools/install.pl
integrationTestsDocker:
name: Run Docker Integration Tests
runs-on: ubuntu-latest
needs: testSuite
steps:
- name: Checkout LANraragi repository
uses: actions/checkout@v6
with:
path: lanraragi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build LRR Docker image
uses: docker/build-push-action@v7
with:
context: lanraragi
file: lanraragi/tools/build/docker/Dockerfile
tags: lanraragi:ci
outputs: type=docker,dest=${{ runner.temp }}/lanraragi-ci.tar
cache-from: type=gha,scope=buildkit-linux-amd64
- name: Load LRR Docker image
run: docker load -i "${{ runner.temp }}/lanraragi-ci.tar"
- name: Checkout aio-lanraragi integration tests
uses: actions/checkout@v6
with:
repository: ${{ env.INTEGRATION_TEST_REPOSITORY }}
ref: ${{ env.INTEGRATION_TEST_REF }}
path: aio-lanraragi
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Install workspace packages
working-directory: aio-lanraragi
run: |
uv sync --all-packages
uv run playwright install
- name: Create staging directory
run: |
mkdir -p "$GITHUB_WORKSPACE/staging"
- name: Run integration tests against local LANraragi build
timeout-minutes: 70
run: |
cd aio-lanraragi/integration_tests
export CI=true
uv run pytest tests --log-cli-level=INFO \
--image lanraragi:ci \
--staging "$GITHUB_WORKSPACE/staging" \
--server-logs "$GITHUB_WORKSPACE/server-logs" \
--cache-backend valkey \
--playwright \
--no-rate-limit \
--npseed 42
env:
DOCKER_HOST: unix:///var/run/docker.sock
- name: Upload server logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: server-logs-ubuntu
path: ${{ github.workspace }}/server-logs/
retention-days: 14
integrationTestsWindows:
name: Run Windows Integration Tests
runs-on: windows-2025
needs: testSuite
steps:
- name: Checkout LANraragi repository
uses: actions/checkout@v6
with:
path: lanraragi
- name: Compute windist cache key
id: windist-key
run: |
$toolsHash = git -C "$env:GITHUB_WORKSPACE\lanraragi" rev-parse HEAD:tools
"key=windist-${{ runner.os }}-$toolsHash" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Restore windist cache
id: cache-windist
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}\windist\win-dist.zip
key: ${{ steps.windist-key.outputs.key }}
- name: Unzip windist from cache
if: steps.cache-windist.outputs.cache-hit == 'true'
run: |
$dest = Join-Path $env:GITHUB_WORKSPACE "LANraragi\win-dist"
New-Item -ItemType Directory -Path $dest -Force | Out-Null
$zip = Join-Path $env:GITHUB_WORKSPACE "windist\win-dist.zip"
Expand-Archive -Path $zip -DestinationPath $dest -Force
- name: Setup MSYS2 UCRT64
if: steps.cache-windist.outputs.cache-hit != 'true'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
cache: false
- name: Install deps
if: steps.cache-windist.outputs.cache-hit != 'true'
shell: msys2 {0}
working-directory: LANraragi
run: |
./tools/build/windows/install-deps.sh
- name: Build
if: steps.cache-windist.outputs.cache-hit != 'true'
shell: msys2 {0}
working-directory: LANraragi
run: |
./tools/build/windows/install.sh
./tools/build/windows/cleanup.sh
./tools/build/windows/create-dist.sh
- name: Enable UTF-8
if: steps.cache-windist.outputs.cache-hit != 'true'
working-directory: LANraragi
run: |
./tools/build/windows/utf8-support.ps1
- name: Create windist zip for cache
if: steps.cache-windist.outputs.cache-hit != 'true'
run: |
$src = Join-Path $env:GITHUB_WORKSPACE "LANraragi\win-dist"
$dstDir = Join-Path $env:GITHUB_WORKSPACE "windist"
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
$zip = Join-Path $dstDir "win-dist.zip"
Compress-Archive -Path (Join-Path $src '*') -DestinationPath $zip
- name: Save windist cache
if: steps.cache-windist.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}\windist\win-dist.zip
key: ${{ steps.windist-key.outputs.key }}
- name: Copy app code to windist
shell: bash
working-directory: LANraragi
run: |
cp ./package.json ./win-dist
cp ./lrr.conf ./win-dist
cp -R ./lib ./win-dist
cp -R ./public ./win-dist
cp -R ./script ./win-dist
cp -R ./templates ./win-dist
cp -R ./locales ./win-dist
- name: Checkout aio-lanraragi integration tests
uses: actions/checkout@v6
with:
repository: ${{ env.INTEGRATION_TEST_REPOSITORY }}
ref: ${{ env.INTEGRATION_TEST_REF }}
path: aio-lanraragi
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Install workspace packages
working-directory: aio-lanraragi
run: |
uv sync --all-packages
uv run playwright install
- name: Create staging directory
run: |
New-Item -ItemType Directory -Path "$env:GITHUB_WORKSPACE\staging" -Force | Out-Null
- name: Run integration tests against local LANraragi build
working-directory: aio-lanraragi/integration_tests
timeout-minutes: 100
run: |
$env:CI='true'
uv run pytest tests `
--log-cli-level=INFO `
--windist "$env:GITHUB_WORKSPACE\LANraragi\win-dist" `
--staging "$env:GITHUB_WORKSPACE\staging" `
--server-logs "$env:GITHUB_WORKSPACE\server-logs" `
--playwright `
--no-rate-limit `
--npseed 42
- name: Upload server logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: server-logs-windows
path: ${{ github.workspace }}\server-logs\
retention-days: 14