Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 14 additions & 131 deletions .github/workflows/push-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
integration_test_ref:
description: 'Integration testing repository git commit hash or branch'
required: true
default: 'dfdcd948cbc6d6bbd2db6620d8499bc8698843e3'
default: 'dev-postgresql/main'

env:
INTEGRATION_TEST_REPOSITORY: ${{ github.event.inputs.integration_test_repository || 'psilabs-dev/aio-lanraragi' }}
INTEGRATION_TEST_REF: ${{ github.event.inputs.integration_test_ref || 'dfdcd948cbc6d6bbd2db6620d8499bc8698843e3' }}
INTEGRATION_TEST_REF: ${{ github.event.inputs.integration_test_ref || 'dev-postgresql/main' }}

name: "Continuous Integration \U0001F44C\U0001F440"
jobs:
Expand All @@ -30,11 +30,15 @@ jobs:
with:
file: ./tools/build/docker/Dockerfile
tags: lanraragi:test
build-args: |
INCLUDE_POSTGRESQL=1
outputs: type=docker
cache-from: type=gha
cache-to: type=gha,mode=max
- name: LANraragi Test Suite
uses: ./.github/action-run-tests
env:
INCLUDE_POSTGRESQL: 1
- name: Perl Critic
uses: Difegue/action-perlcritic@master
env:
Expand All @@ -59,6 +63,8 @@ jobs:
context: lanraragi
file: lanraragi/tools/build/docker/Dockerfile
tags: lanraragi:ci
build-args: |
INCLUDE_POSTGRESQL=1
outputs: type=docker,dest=${{ runner.temp }}/lanraragi-ci.tar
cache-from: type=gha
cache-to: type=gha,mode=max
Expand All @@ -85,143 +91,20 @@ jobs:
run: |
mkdir -p "$GITHUB_WORKSPACE/staging"
- name: Run integration tests against local LANraragi build
timeout-minutes: 30
timeout-minutes: 50
run: |
cd aio-lanraragi/integration_tests
export CI=true
uv run pytest tests --log-cli-level=INFO \
--image lanraragi:ci \
--staging "$GITHUB_WORKSPACE/staging" \
--playwright \
--postgres \
--dev search \
--npseed 42 \
-k "not test_double_page_navigation and not test_handler_resource_management"
-k "not test_double_page_navigation and not test_handler_resource_management and not test_header_click_sort and not test_compact_column_sort_with_three_columns and not test_custom_column_sort_display"
env:
DOCKER_HOST: unix:///var/run/docker.sock

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
# Keep in sync with tools/build/windows/install-deps.sh
install: >-
mingw-w64-ucrt-x86_64-perl
mingw-w64-ucrt-x86_64-perl-win32-api
mingw-w64-ucrt-x86_64-openssl
mingw-w64-ucrt-x86_64-imagemagick
mingw-w64-ucrt-x86_64-libjxl
mingw-w64-ucrt-x86_64-libheif
mingw-w64-ucrt-x86_64-ghostscript
mingw-w64-ucrt-x86_64-zlib
mingw-w64-ucrt-x86_64-lzo2
mingw-w64-ucrt-x86_64-libarchive
mingw-w64-ucrt-x86_64-ca-certificates
mingw-w64-ucrt-x86_64-libvips
libxcrypt
unzip
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-make
make
mingw-w64-ucrt-x86_64-diffutils
libbz2-devel
patch
mingw-w64-ucrt-x86_64-nodejs
mingw-w64-ucrt-x86_64-tools
- 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: 50
run: |
$env:CI='true'
uv run pytest tests `
--log-cli-level=INFO `
--windist "$env:GITHUB_WORKSPACE\LANraragi\win-dist" `
--staging "$env:GITHUB_WORKSPACE\staging" `
--playwright `
--npseed 42 `
-k "not test_double_page_navigation and not test_handler_resource_management"
# Windows integration tests disabled — no PostgreSQL support on Windows.
# See upstream integrationTestsWindows job for reference.
4 changes: 4 additions & 0 deletions CUSTOM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# custom release

- always show page count
- render summary with HTML
14 changes: 13 additions & 1 deletion lib/LANraragi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ use LANraragi::Utils::I18NInitializer;

use LANraragi::Model::Search;
use LANraragi::Model::Config;
use LANraragi::Model::Setup qw(first_install_actions);
use LANraragi::Model::PsilabsDev::PgSetup qw(first_install_actions);
use LANraragi::Model::Metrics;

use LANraragi::Utils::PsilabsDev::Database;

use constant IS_UNIX => ( $Config{osname} ne 'MSWin32' );

# This method will run once at server start
Expand Down Expand Up @@ -113,6 +115,16 @@ sub startup {
# Initialize cache
LANraragi::Utils::PageCache::initialize();

# Initialize database schema
eval {
LANraragi::Utils::PsilabsDev::Database::initialize();
$self->LRR_LOGGER->info("Initialized database schema.");
} or do {
my $error = $@;
$self->LRR_LOGGER->error("Failed to initialize database schema: $error");
die "Failed to initialize database schema: $error";
};

# Load i18n
LANraragi::Utils::I18NInitializer::initialize($self);

Expand Down
Loading
Loading