Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
36911d2
Install Perl5 and dev tools for Inline::Perl5
zaucker Nov 27, 2025
ace26fe
Fix DB access
zaucker Nov 27, 2025
5827aba
Fix PG port
zaucker Nov 27, 2025
08d3941
Add Excel Perl5 module to work flow
zaucker Nov 27, 2025
d0d421f
Fix/improve
zaucker Nov 27, 2025
cce9b8d
Set POSTGRES_DB
zaucker Nov 27, 2025
03a7c08
Fix DB permissions
zaucker Nov 27, 2025
e8086d2
Add password for agrammon DB user
zaucker Nov 27, 2025
92da7ea
Create database first
zaucker Nov 27, 2025
b6ecd47
Add grants
zaucker Nov 27, 2025
1b890e0
Fix DB
zaucker Nov 27, 2025
bce12df
Setup DB first
zaucker Nov 27, 2025
50010e7
Checkout Repo first
zaucker Nov 27, 2025
5862389
Change database owner
zaucker Nov 27, 2025
857979c
Change database owner
zaucker Nov 27, 2025
832e860
Change grants
zaucker Nov 27, 2025
3a14b20
Change grants
zaucker Nov 27, 2025
534146f
Change grants
zaucker Nov 27, 2025
e64646c
Change grants
zaucker Nov 27, 2025
7ab6974
Change grants
zaucker Nov 27, 2025
a630440
Change owner
zaucker Nov 27, 2025
b571651
Change owner
zaucker Nov 27, 2025
374ddc2
Limit tests
zaucker Nov 27, 2025
8d08d9f
Limit tests
zaucker Nov 27, 2025
30e6d82
Don't create test user
zaucker Nov 27, 2025
220cf2d
Try without latex-extras
zaucker Nov 27, 2025
1be4446
Try without latex-extras
zaucker Nov 27, 2025
eaf717e
Add latex-extras again
zaucker Nov 27, 2025
806e420
Try LaTeX cache
zaucker Nov 27, 2025
f1bb235
Enforce cache
zaucker Nov 27, 2025
dd5451e
No schema creation
zaucker Nov 27, 2025
78713fc
Run all tests
zaucker Nov 27, 2025
c742050
Use Rakudo 2025.11
zaucker Nov 27, 2025
b0d4514
Test Ubuntu 2024.04 as well
zaucker Nov 27, 2025
f227572
Fix cache keys
zaucker Nov 27, 2025
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
76 changes: 53 additions & 23 deletions .github/workflows/backend-and-models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ jobs:
matrix:
os:
- ubuntu-22.04
- ubuntu-24.04
raku-version:
- '2025.01'
- '2025.11'
runs-on: ${{ matrix.os }}

services:
Expand All @@ -26,21 +27,63 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: agrammon_test
ports:
- 5432:5432
- 55432:5432
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Install LaTeX
# Checkout repository first as we need dev/pgpass for PostgreSQL access
- name: Checkout repo
uses: actions/checkout@v2

- name: Load test database
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGPASSFILE: ./dev/pgpass
POSTGRES_DB: postgres
AGRAMMON_DB: agrammon_test
AGRAMMON_OWNER: agrammon
AGRAMMON_GROUP: agrammon_user
AGRAMMON_SCHEMA: ./t/test-data/agrammon.schema.sql
AGRAMMON_TEST_DATA: ./t/test-data/agrammon.test.sql
run: |
chmod 0600 $PGPASSFILE
psql -U $POSTGRES_USER -h localhost --port 55432 -c "CREATE USER $AGRAMMON_OWNER PASSWORD 'agrammon'" > /dev/null
psql -U $POSTGRES_USER -h localhost --port 55432 -c "CREATE GROUP $AGRAMMON_GROUP USER $AGRAMMON_OWNER" > /dev/null
psql -U $POSTGRES_USER -h localhost --port 55432 -c "ALTER DATABASE $AGRAMMON_DB OWNER TO $AGRAMMON_OWNER" > /dev/null
psql -U $AGRAMMON_OWNER -h localhost --port 55432 --file=$AGRAMMON_SCHEMA $AGRAMMON_DB > /dev/null
psql -U $AGRAMMON_OWNER -h localhost --port 55432 --file=$AGRAMMON_TEST_DATA $AGRAMMON_DB > /dev/null

- name: Setup apt cache
uses: actions/cache@v4
id: aptCache
with:
path: |
/var/cache/apt/archives
/var/lib/apt/lists
key: ${{ matrix.os }}-apt-${{ hashFiles('.github/workflows/backend-and-models.yml') }}

- name: Install system dependencies
run: |
sudo apt update
sudo apt-get install texlive texlive-luatex texlive-latex-recommended texlive-latex-extra texlive-science
sudo apt-get install -y libperl-dev texlive texlive-luatex texlive-latex-recommended texlive-science texlive-latex-extra

- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Perl modules cache
uses: actions/cache@v4
id: perlCache
with:
path: Inline/perl5
key: ${{ matrix.os }}-perl-${{ hashFiles('**/cpanfile', '**/cpanfile.snapshot') }}-excel-writer-xlsx-v1

- name: Install Perl modules
if: steps.perlCache.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y cpanminus
cpanm --notest --local-lib=Inline/perl5 Excel::Writer::XLSX

- name: Setup raku
uses: Raku/setup-raku@v1
Expand All @@ -52,7 +95,7 @@ jobs:
id: rakuCache
with:
path: .raku
key: ${{ runner.os }}-${{ matrix.raku-version }}-${{ hashFiles('./dev/META6.json') }}
key: ${{ matrix.os }}-${{ matrix.raku-version }}-${{ hashFiles('./dev/META6.json') }}

- name: Install Raku modules
if: steps.rakuCache.outputs.cache-hit != 'true'
Expand All @@ -65,6 +108,7 @@ jobs:
find t/test-data/Models/hr-inclNOx* -type f -print0 | sort -z | xargs -0 shasum > ./MODEL_MD5
cat ./MODEL_MD5
mkdir -p $HOME/.agrammon
touch $HOME/.agrammon/.gitkeep

- name: Setup model cache
uses: actions/cache@v4
Expand All @@ -73,21 +117,7 @@ jobs:
path: $HOME/.agrammon
key: AgrammonModels-${{ hashFiles('./MODEL_MD5') }}

- name: Load test database
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: agrammon_test
PGPASSFILE: ./dev/pgpass
AGRAMMON_DUMP: ./t/test-data/agrammon_test.dump.sql
run: |
chmod 0600 $PGPASSFILE
psql -U postgres -h localhost -c "CREATE USER agrammon PASSWORD 'agrammonATwork'" > /dev/null
psql -U postgres -h localhost -c "CREATE GROUP agrammon_user USER agrammon" > /dev/null
psql -U postgres -h localhost -c "GRANT ALL ON SCHEMA public TO agrammon_user" > /dev/null
psql -U postgres -h localhost -c "CREATE EXTENSION pgcrypto" agrammon_test > /dev/null
psql -U postgres -h localhost --file=$AGRAMMON_DUMP $POSTGRES_DB > /dev/null

- name: Run backend tests
run: |
RAKULIB=inst#$GITHUB_WORKSPACE/.raku $GITHUB_WORKSPACE/.raku/bin/prove6 -l -v t
PERL5LIB=Inline/perl5/lib/perl5 RAKULIB=inst#$GITHUB_WORKSPACE/.raku $GITHUB_WORKSPACE/.raku/bin/prove6 -l -v t
# PERL5LIB=Inline/perl5/lib/perl5 RAKULIB=inst#$GITHUB_WORKSPACE/.raku $GITHUB_WORKSPACE/.raku/bin/prove6 -l -v t/datasource-db.rakutest
1 change: 1 addition & 0 deletions dev/pgpass
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*:*:*:agrammon:agrammon
*:*:*:postgres:postgres
13 changes: 4 additions & 9 deletions t/datasource-db.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ transactionally {
sub prepare-test-db-single-data($user, $dataset, %variant) {
my $db = $*AGRAMMON-DB-HANDLE;

prepare-test-db-schema($db, $user);
# prepare-test-db-schema($db);

my $userId = $db.query(q:to/STATEMENT/, $user).value;
SELECT pers_email2id($1)
Expand Down Expand Up @@ -239,7 +239,7 @@ sub prepare-test-db-single-data($user, $dataset, %variant) {
sub prepare-test-db-flattened-data($user, $dataset, %variant) {
my $db = $*AGRAMMON-DB-HANDLE;

prepare-test-db-schema($db, $user);
# prepare-test-db-schema($db);

my $userId = $db.query(q:to/STATEMENT/, $user).value;
SELECT pers_email2id($1)
Expand Down Expand Up @@ -284,7 +284,7 @@ sub prepare-test-db-flattened-data($user, $dataset, %variant) {
sub prepare-test-db-branched-data($user, $dataset, %variant) {
my $db = $*AGRAMMON-DB-HANDLE;

prepare-test-db-schema($db, $user);
# prepare-test-db-schema($db);

my $userId = $db.query(q:to/STATEMENT/, $user).value;
SELECT pers_email2id($1)
Expand Down Expand Up @@ -333,7 +333,7 @@ sub prepare-test-db-branched-data($user, $dataset, %variant) {
$sth-data.execute($datasetId, 'Instance B', 'Test::Base[]::AnotherSubA::simple', 101);
}

sub prepare-test-db-schema($db, $user) {
sub prepare-test-db-schema($db) {
$db.query(q:to/STATEMENT/);
CREATE TABLE IF NOT EXISTS pers (
pers_id SERIAL NOT NULL PRIMARY KEY, -- Unique ID
Expand Down Expand Up @@ -384,11 +384,6 @@ sub prepare-test-db-schema($db, $user) {
CREATE OR REPLACE FUNCTION dataset_name2id(USERNAME text, NAME text) returns int4
AS 'SELECT dataset_id FROM dataset WHERE dataset_name = $2 AND dataset_pers = pers_email2id($1)' STABLE LANGUAGE 'sql'
STATEMENT

$db.query(q:to/STATEMENT/, $user);
INSERT INTO pers (pers_email, pers_first, pers_last, pers_password)
VALUES ($1, 'X', 'X', 'X')
STATEMENT
}

done-testing;
Loading