Skip to content

Commit 4089728

Browse files
authored
Spring cleaning: metadata, CI containerization, release workflow (NicTool#338)
Housekeeping - Add root AGPL-3.0 LICENSE file - Fix surname across all source files and Makefile.PL AUTHOR fields - Remove stale META.yml files (generated by make dist) - Update README with current status, Docker quickstart, fix forum link
1 parent aa66715 commit 4089728

108 files changed

Lines changed: 1222 additions & 444 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-image.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI Image
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'dist/docker/Dockerfile'
8+
- '.github/workflows/ci-image.yml'
9+
- 'server/Makefile.PL'
10+
- 'client/Makefile.PL'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- name: Compute image tag
24+
id: meta
25+
run: echo "tag=ghcr.io/${GITHUB_REPOSITORY,,}/build:latest" >> "$GITHUB_OUTPUT"
26+
27+
- uses: docker/setup-buildx-action@v4
28+
29+
- uses: docker/login-action@v4
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- uses: docker/build-push-action@v7
36+
with:
37+
context: .
38+
file: dist/docker/Dockerfile
39+
target: base
40+
push: true
41+
tags: ${{ steps.meta.outputs.tag }}
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max

.github/workflows/ci.yml

Lines changed: 85 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -13,135 +13,120 @@ on:
1313

1414
permissions:
1515
contents: read
16+
packages: read
1617

1718
jobs:
1819
test:
19-
runs-on: ubuntu-22.04
20-
20+
runs-on: ubuntu-24.04
2121
steps:
2222
- uses: actions/checkout@v6
2323

24-
- name: Install system dependencies
24+
- uses: docker/setup-buildx-action@v4
25+
26+
- uses: docker/login-action@v4
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Compute GHCR cache ref
33+
id: meta
34+
run: echo "ref=ghcr.io/${GITHUB_REPOSITORY,,}/build:latest" >> "$GITHUB_OUTPUT"
35+
36+
- name: Build CI base image
37+
uses: docker/build-push-action@v7
38+
with:
39+
context: .
40+
file: dist/docker/Dockerfile
41+
target: base
42+
tags: nictool-ci:latest
43+
load: true
44+
cache-from: |
45+
type=registry,ref=${{ steps.meta.outputs.ref }}
46+
type=gha,scope=ci
47+
cache-to: type=gha,mode=max,scope=ci
48+
49+
- name: Generate test credentials
50+
run: |
51+
echo "DB_PW=$(openssl rand -base64 24)" >> "$GITHUB_ENV"
52+
echo "ROOT_PW=$(openssl rand -base64 24)" >> "$GITHUB_ENV"
53+
54+
- name: Create test network and start MySQL
55+
run: |
56+
docker network create ci
57+
docker run -d --name mysql --network ci \
58+
-e MYSQL_ROOT_PASSWORD=root \
59+
-e MYSQL_DATABASE=nictool \
60+
--health-cmd="mysqladmin ping -h 127.0.0.1" \
61+
--health-interval=5s \
62+
--health-timeout=3s \
63+
--health-retries=10 \
64+
mysql:8
65+
66+
- name: Start CI container
2567
run: |
26-
sudo apt-get update
27-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
28-
expat \
29-
cpanminus \
30-
libdbix-simple-perl \
31-
libdbd-mysql-perl \
32-
apache2 \
33-
libapache2-mod-perl2 \
34-
libapache2-mod-perl2-dev \
35-
libapache-dbi-perl \
36-
gettext \
37-
libxml2 \
38-
libnet-ip-perl \
39-
libxml-libxml-perl \
40-
libxml-parser-perl \
41-
libdigest-hmac-perl \
42-
libjson-perl \
43-
librpc-xml-perl \
44-
libsoap-lite-perl \
45-
libmodule-build-perl \
46-
libmime-base32-perl \
47-
libmime-base64-perl \
48-
libbind-confparser-perl \
49-
libssl-dev \
50-
libcrypt-openssl-rsa-perl \
51-
libcrypt-openssl-dsa-perl \
52-
libnet-dns-perl \
53-
libyaml-perl \
54-
bind9utils \
55-
libwww-perl \
56-
liburi-perl \
57-
libmime-tools-perl \
58-
libmailtools-perl \
59-
libfile-sharedir-perl \
60-
libperl-prereqscanner-perl \
61-
libdbi-perl \
62-
libcgi-pm-perl \
63-
libtest-pod-perl \
64-
libtest-output-perl \
65-
libtest-simple-perl \
66-
default-mysql-client
67-
68-
- name: Wait for MySQL service
68+
docker run -d --name ci --network ci \
69+
-v "$GITHUB_WORKSPACE:/workspace" \
70+
-w /workspace \
71+
-e NICTOOL_DB_USER_PASSWORD="$DB_PW" \
72+
-e DB_ROOT_PASSWORD=root \
73+
-e NICTOOL_DB_USER=nictool \
74+
-e NICTOOL_DB_NAME=nictool \
75+
-e DB_ENGINE=mysql \
76+
-e DB_HOSTNAME=mysql \
77+
-e ROOT_USER_EMAIL=ci@nictool.test \
78+
-e ROOT_USER_PASSWORD="$ROOT_PW" \
79+
-e NICTOOL_CLIENT_DIR=/workspace/client \
80+
nictool-ci:latest sleep infinity
81+
82+
- name: Wait for MySQL
6983
run: |
70-
sudo /etc/init.d/mysql start
71-
for attempt in $(seq 1 10); do
72-
if mysqladmin ping -h 127.0.0.1 --silent; then
84+
for i in $(seq 1 60); do
85+
if docker inspect --format='{{.State.Health.Status}}' mysql 2>/dev/null | grep -q healthy; then
86+
echo "MySQL is healthy"
7387
exit 0
7488
fi
7589
sleep 2
7690
done
77-
exit 1
91+
echo "MySQL failed to become healthy" && exit 1
7892
79-
- name: Generate test credentials
93+
- name: Install NicTool client and server
8094
run: |
81-
DB_PW=$(openssl rand -base64 24)
82-
ROOT_PW=$(openssl rand -base64 24)
83-
echo "NICTOOL_DB_USER_PASSWORD=$DB_PW" >> "$GITHUB_ENV"
84-
echo "DB_ROOT_PASSWORD=root" >> "$GITHUB_ENV"
85-
echo "NICTOOL_DB_USER=nictool" >> "$GITHUB_ENV"
86-
echo "NICTOOL_DB_NAME=nictool" >> "$GITHUB_ENV"
87-
echo "DB_ENGINE=mysql" >> "$GITHUB_ENV"
88-
echo "DB_HOSTNAME=localhost" >> "$GITHUB_ENV"
89-
echo "ROOT_USER_EMAIL=ci@nictool.test" >> "$GITHUB_ENV"
90-
echo "ROOT_USER_PASSWORD=$ROOT_PW" >> "$GITHUB_ENV"
91-
echo "NICTOOL_CLIENT_DIR=$GITHUB_WORKSPACE/client" >> "$GITHUB_ENV"
92-
echo "DB_SSL=1" >> "$GITHUB_ENV"
95+
docker exec ci bash -c '
96+
cd /workspace/client && perl Makefile.PL && cpanm -n .
97+
cd /workspace/server && perl Makefile.PL && cpanm -n .
98+
'
9399
94100
- name: Allow Apache to traverse workspace path
95101
run: |
96-
# Ubuntu 21.04+ defaults home dirs to 750; www-data needs o+x to traverse
97-
dir="$GITHUB_WORKSPACE"
98-
while [ "$dir" != "/" ]; do
99-
sudo chmod o+x "$dir"
100-
dir="$(dirname "$dir")"
101-
done
102+
docker exec ci bash -c '
103+
dir="/workspace"
104+
while [ "$dir" != "/" ]; do
105+
chmod o+x "$dir"
106+
dir="$(dirname "$dir")"
107+
done
108+
'
102109
103110
- name: Set up NicTool configs, Apache, and TLS
104-
run: sudo -E dist/setup/install-nictool.sh --nt-dir="$GITHUB_WORKSPACE"
105-
106-
- name: Install Perl modules for Apache/mod_perl
107-
run: |
108-
sudo cpanm --notest \
109-
CryptX Crypt::Mac::HMAC Crypt::KeyDerivation \
110-
Test::HTML::Lint Time::TAI64 DBD::MariaDB
111-
112-
- name: Install NicTool client and server
113-
run: |
114-
cd "$GITHUB_WORKSPACE/client"
115-
perl Makefile.PL
116-
sudo cpanm -n .
111+
run: docker exec ci dist/setup/install-nictool.sh --nt-dir=/workspace
117112

118-
cd "$GITHUB_WORKSPACE/server"
119-
perl Makefile.PL
120-
sudo cpanm -n .
121-
122-
- name: Restart Apache
123-
run: sudo service apache2 restart || sudo cat /var/log/apache2/error.log
113+
- name: Start Apache
114+
run: docker exec ci apachectl start
124115

125116
- name: Create NicTool test database
126-
run: |
127-
cd "$GITHUB_WORKSPACE/server/sql"
128-
echo "" | perl create_tables.pl --environment
117+
run: docker exec ci bash -c 'cd /workspace/server/sql && echo "" | perl create_tables.pl --environment'
129118

130119
- name: Create test user and test.cfg
131-
run: perl dist/setup/setup-test-env.pl
120+
run: docker exec ci perl dist/setup/setup-test-env.pl
132121

133122
- name: Run client tests
134-
run: make -C "$GITHUB_WORKSPACE/client" test
123+
run: docker exec ci make -C /workspace/client test
135124

136125
- name: Run server tests
137-
run: make -C "$GITHUB_WORKSPACE/server" test
126+
run: docker exec ci make -C /workspace/server test
138127

139128
- name: Failure diagnostics
140129
if: failure()
141130
run: |
142-
pwd
143-
mysql --version
144-
apache2 -version
145-
sudo cat /var/log/apache2/error.log || true
146-
cat /etc/apache2/apache2.conf || true
147-
ls /usr/lib/apache2/modules/ || true
131+
docker exec ci cat /var/log/apache2/error.log 2>/dev/null || true
132+
docker logs mysql 2>&1 | tail -50 || true

.github/workflows/docker.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ permissions:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-22.04
17+
runs-on: ubuntu-24.04
1818
steps:
1919
- uses: actions/checkout@v6
2020

2121
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v3
22+
uses: docker/setup-buildx-action@v4
2323

2424
- name: Build Docker image
25-
uses: docker/build-push-action@v6
25+
uses: docker/build-push-action@v7
2626
with:
2727
context: .
2828
file: dist/docker/Dockerfile
@@ -32,15 +32,15 @@ jobs:
3232

3333
docker-tests:
3434
needs: build
35-
runs-on: ubuntu-22.04
35+
runs-on: ubuntu-24.04
3636
steps:
3737
- uses: actions/checkout@v6
3838

3939
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
40+
uses: docker/setup-buildx-action@v4
4141

4242
- name: Load Docker image from cache
43-
uses: docker/build-push-action@v6
43+
uses: docker/build-push-action@v7
4444
with:
4545
context: .
4646
file: dist/docker/Dockerfile
@@ -72,15 +72,15 @@ jobs:
7272
7373
e2e-tests:
7474
needs: build
75-
runs-on: ubuntu-22.04
75+
runs-on: ubuntu-24.04
7676
steps:
7777
- uses: actions/checkout@v6
7878

7979
- name: Set up Docker Buildx
80-
uses: docker/setup-buildx-action@v3
80+
uses: docker/setup-buildx-action@v4
8181

8282
- name: Load Docker image from cache
83-
uses: docker/build-push-action@v6
83+
uses: docker/build-push-action@v7
8484
with:
8585
context: .
8686
file: dist/docker/Dockerfile
@@ -99,14 +99,14 @@ jobs:
9999
timeout-minutes: 5
100100

101101
- name: Set up Node.js
102-
uses: actions/setup-node@v4
102+
uses: actions/setup-node@v6
103103
with:
104104
node-version: 22
105105
cache: npm
106106
cache-dependency-path: client/t/e2e/package-lock.json
107107

108108
- name: Cache Playwright browsers
109-
uses: actions/cache@v4
109+
uses: actions/cache@v5
110110
id: playwright-cache
111111
with:
112112
path: ~/.cache/ms-playwright

0 commit comments

Comments
 (0)