hail eris #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test pg_ddate | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| postgres: [14, 15, 16, 17] | |
| name: PostgreSQL ${{ matrix.postgres }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| sed -i 's/postgres:16/postgres:${{ matrix.postgres }}/g' Dockerfile | |
| sed -i 's/postgresql-server-dev-16/postgresql-server-dev-${{ matrix.postgres }}/g' Dockerfile | |
| docker build -t pg_ddate . | |
| - name: Run tests | |
| run: | | |
| docker run --rm -d --name pg_ddate_test -e POSTGRES_HOST_AUTH_METHOD=trust pg_ddate | |
| sleep 5 | |
| docker cp test.sql pg_ddate_test:/tmp/test.sql | |
| docker exec pg_ddate_test psql -U postgres -v ON_ERROR_STOP=1 -f /tmp/test.sql | |
| test-features: | |
| runs-on: ubuntu-latest | |
| name: Feature Tests | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build and test | |
| run: make docker-test | |
| - name: Test holiday input parsing | |
| run: | | |
| docker run --rm -d --name pg_feature_test -e POSTGRES_HOST_AUTH_METHOD=trust pg_ddate | |
| sleep 10 | |
| echo "Testing holiday input parsing..." | |
| docker exec pg_feature_test psql -U postgres -v ON_ERROR_STOP=1 -c " | |
| CREATE EXTENSION pg_ddate; | |
| SELECT 'Mungday, Chaos 5, 3191 YOLD'::ddate; | |
| SELECT 'Chaoflux, Chaos 50, 3191 YOLD'::ddate; | |
| SELECT 'Discoflux, Discord 50, 3191 YOLD'::ddate; | |
| " | |
| echo "Testing ~ operator..." | |
| docker exec pg_feature_test psql -U postgres -v ON_ERROR_STOP=1 -c " | |
| SELECT '2025-02-19'::date::ddate ~ 'Chaoflux' AS flux_test; | |
| SELECT '2025-01-01'::date::ddate ~ 'Sweetmorn' AS weekday_test; | |
| SELECT '2025-01-01'::date::ddate ~ '3191 YOLD' AS year_test; | |
| SELECT '2025-01-01'::date::ddate ~ 'Discord' AS false_test; | |
| " | |
| echo "Testing flux holidays are correctly displayed..." | |
| docker exec pg_feature_test psql -U postgres -v ON_ERROR_STOP=1 -c " | |
| SELECT '2025-02-19'::date::ddate; -- Should be Chaoflux | |
| SELECT '2025-05-03'::date::ddate; -- Should be Discoflux | |
| SELECT '2025-07-15'::date::ddate; -- Should be Confuflux | |
| SELECT '2025-09-26'::date::ddate; -- Should be Bureflux | |
| SELECT '2025-12-08'::date::ddate; -- Should be Afflux | |
| " | |
| docker stop pg_feature_test || true |