mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 13:32:43 -05:00
* PostgreSQL: the owner was never the story, so stop asking who owns the tables For as long as the install check has existed, it asked pg_tables who owned the tables and compared that against the database login. Nobody asked why. The login is a gateway user, the tables belong to whatever role ran the install, and whenever those two names diverged the check reported the schema as missing. Visibility was the question all along. tablesAreCorrect() now asks pg_class which ordinary and partitioned tables are visible on the search_path. If PostgreSQL can see it, it counts. A table parked in a schema outside the path does not hide a missing one, and a view named like a table is not a table. The new test builds a role, a visible schema, a hidden schema, and a view with a suspicious name, then checks that each answer is the true one. It runs against a real PostgreSQL 18 service in CI. Locally it skips unless FRESHRSS_TEST_PGSQL_DSN is set. * Pin the CI Postgres service to a digest, because somebody moved the tag For the record: nobody announced it. The postgres:18-alpine tag sat in tests.yml like a loaded gun pointed at every CI run, and zizmor was the first thing to notice it had no fixed identity at all. Remember the Denver Airport. Remember that tags are not promises. This commit replaces the mutable tag with the exact multi-arch digest the suite was already tested against: postgres:18-alpine@sha256:eaef288f54a90a909e49f0121d5d047a5e974e922699de4249625cf7cde34f36 This is not a version bump. Same image, same PostgreSQL 18, same Alpine base. The only thing that changed is that the image can no longer be swapped out from under us between Tuesday's green run and Thursday's mystery failure. Verification: all pre-commit PHP, test, JS, CSS and Markdown checks pass. Local pedantic offline zizmor reports no findings. This resolves the unpinned-service-image blocker on PR #9535. * Rewrite test a bit * Fix make test-all --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
149 lines
4.2 KiB
YAML
149 lines
4.2 KiB
YAML
name: Automated tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ edge ]
|
|
pull_request:
|
|
branches: [ edge ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
name: tests
|
|
# https://github.com/actions/runner-images
|
|
runs-on: ubuntu-26.04
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18-alpine@sha256:eaef288f54a90a909e49f0121d5d047a5e974e922699de4249625cf7cde34f36
|
|
env:
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
ports:
|
|
- 127.0.0.1:5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
env:
|
|
FRESHRSS_TEST_PGSQL_DSN: pgsql:host=127.0.0.1;dbname=postgres;user=postgres
|
|
|
|
steps:
|
|
- name: Git checkout source code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Composer tests
|
|
|
|
- name: Check PHP syntax
|
|
run: composer run-script php-lint
|
|
|
|
- name: Check PHTML syntax
|
|
run: composer run-script phtml-lint
|
|
|
|
- name: Check translations syntax
|
|
run: composer run-script translations && git diff --exit-code
|
|
|
|
- name: Use Composer cache
|
|
id: composer-cache
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: vendor
|
|
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-php-
|
|
|
|
- name: Run Composer install
|
|
run: composer install --prefer-dist --no-progress
|
|
if: steps.composer-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Run PHP unit tests
|
|
run: composer run-script phpunit -- --no-progress
|
|
|
|
- name: PHP_CodeSniffer
|
|
run: composer run-script phpcs
|
|
|
|
- name: PHPStan
|
|
run: composer run-script phpstan -- --no-progress
|
|
|
|
# - name: PHPStan Next
|
|
# run: composer run-script phpstan-next -- --no-progress
|
|
|
|
# NPM tests
|
|
|
|
- name: Uses Node.js
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
# https://nodejs.org/en/about/previous-releases
|
|
node-version: lts/*
|
|
cache: npm
|
|
|
|
- run: npm ci
|
|
|
|
- name: Check JavaScript syntax
|
|
run: npm run --silent eslint
|
|
|
|
- name: Check Markdown syntax
|
|
run: npm run --silent markdownlint
|
|
|
|
- name: Check CSS syntax
|
|
run: npm run --silent stylelint
|
|
|
|
- name: Check Right-to-left CSS
|
|
run: npm run --silent rtlcss && git diff --exit-code
|
|
|
|
- name: Optimize SVG image files
|
|
run: npm run --silent svgo && git diff --exit-code
|
|
|
|
# Shell tests
|
|
|
|
- name: Use shell cache
|
|
id: shell-cache
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: bin
|
|
key: ${{ runner.os }}-bin-shfmt@v3.8.0-hadolint@v2.15.1-typos@v1.49.0
|
|
|
|
- name: Add ./bin/ to $PATH
|
|
run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install shfmt
|
|
if: steps.shell-cache.outputs.cache-hit != 'true'
|
|
run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.8.0
|
|
|
|
- name: Check shell script syntax
|
|
run: ./tests/shellchecks.sh
|
|
|
|
- name: Install hadolint
|
|
if: steps.shell-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.15.1/hadolint-linux-x86_64" &&
|
|
echo 'c7187db94eeeeca956519a6af171adc31453941a1e777961f6e680f697c8c507 ./bin/hadolint' | sha256sum -c - &&
|
|
chmod 700 ./bin/hadolint
|
|
|
|
- name: Check Dockerfile syntax
|
|
run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning
|
|
|
|
- name: Install typos
|
|
if: steps.shell-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd bin ;
|
|
wget -q 'https://github.com/crate-ci/typos/releases/download/v1.49.0/typos-v1.49.0-x86_64-unknown-linux-musl.tar.gz' &&
|
|
echo '48bd2d58e02ce713b8c0f1aa239e68ee4f7d8c551013135806e6aed3938d9e10 typos-v1.49.0-x86_64-unknown-linux-musl.tar.gz' | sha256sum -c - &&
|
|
tar -xvf *.tar.gz './typos' &&
|
|
chmod +x typos &&
|
|
rm *.tar.gz ;
|
|
cd ..
|
|
|
|
- name: Check spelling
|
|
run: bin/typos
|