Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
44 changes: 44 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Build artifacts
target/
*.so
*.dylib
*.dll

# IDE files
.vscode/
.idea/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db

# Git
.git/
.gitignore

# Documentation build
site/
docs/site/

# Test results
results/
regression.diffs
regression.out

# Local development
.env
.env.local

# Cache
.cache/
node_modules/

# Logs
*.log

# Temporary files
tmp/
temp/
3 changes: 3 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GITHUB_ACCESS_TOKEN=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
GITHUB_INSTANCE_URL=https://github.com
GITLAB_INSTANCE_URL=https://gitlab.com
45 changes: 45 additions & 0 deletions .github/workflows/build_all_versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Main workflow that uses the reusable build_and_test_pgver workflow
# Similar to how GitLab CI would include the template

name: 'Build and Test All PostgreSQL Versions'

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '0 2 * * 0' # Weekly on Sunday at 2 AM
workflow_dispatch:

jobs:
# Build and test PostgreSQL 13 (with always flag)
pg13:
uses: ./.github/workflows/build_and_test_pgver.yml
with:
pgver: 'pg13'
always: 'true' # Always run for pg13

# Build and test PostgreSQL 14
pg14:
uses: ./.github/workflows/build_and_test_pgver.yml
with:
pgver: 'pg14'

# Build and test PostgreSQL 15
pg15:
uses: ./.github/workflows/build_and_test_pgver.yml
with:
pgver: 'pg15'

# Build and test PostgreSQL 16
pg16:
uses: ./.github/workflows/build_and_test_pgver.yml
with:
pgver: 'pg16'

# Build and test PostgreSQL 17
pg17:
uses: ./.github/workflows/build_and_test_pgver.yml
with:
pgver: 'pg17'
168 changes: 168 additions & 0 deletions .github/workflows/build_and_test_pgver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# GitHub Actions workflow converted from GitLab CI template
# Original: .gitlab/job_templates/build_and_test_pgver.yml

name: 'Build and Test PostgreSQL Version'

on:
workflow_call:
inputs:
always:
description: 'If defined, all jobs are launched in any case. Usually you want at least 1 major version to be built/tested on all pipelines.'
type: string
default: ''
required: false
pgver:
description: 'The PostgreSQL major version with the "pg" prefix (e.g. `pg13`, `pg16`, etc.)'
type: string
required: true
workflow_dispatch:
inputs:
pg_version:
description: 'PostgreSQL version'
required: true
default: '13'

env:
PGVER: ${{ inputs.pgver }}
ALWAYS: ${{ inputs.always }}

jobs:
##
## B U I L D
##
build:
name: 'build-${{ inputs.pgver }}'
runs-on: ubuntu-latest
# Use GitHub Container Registry for pmpetit
container: ghcr.io/pmpetit/postgresql_pglinter:pgrx

# Convert GitLab rules to GitHub Actions conditions
if: |
inputs.always != '' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.ref == github.event.repository.default_branch ||
startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Lint (only for default PG version)
if: inputs.always != ''
run: make lint

- name: Build the extension package
run: make

- name: Launch postgres instance and run unit tests
run: make test
# The functional tests will be launched later with pg_regress

- name: Build packages
run: |
make deb
make rpm

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: 'pglinter-${{ inputs.pgver }}'
path: 'target/release/pglinter-${{ inputs.pgver }}'
retention-days: 1

##
## T E S T
##
installcheck:
name: 'installcheck-${{ inputs.pgver }}'
runs-on: ubuntu-latest
needs: build
container: ghcr.io/pmpetit/postgresql_pglinter:pgrx

if: |
inputs.always != '' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.ref == github.event.repository.default_branch ||
startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: 'pglinter-${{ inputs.pgver }}'
path: 'target/release/pglinter-${{ inputs.pgver }}'

- name: Install binaries
run: make install

- name: Run functional tests with pg_regress
run: make installcheck

- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: 'test-results-${{ inputs.pgver }}'
path: |
target/release/pglinter-${{ inputs.pgver }}
results
retention-days: 1

##
## D E P L O Y
##
upload-packages:
name: 'upload-packages-${{ inputs.pgver }}'
runs-on: ubuntu-latest
needs: build

# Convert GitLab rules: run on tags always, otherwise manual
if: |
startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'workflow_dispatch'

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: 'pglinter-${{ inputs.pgver }}'
path: 'target/release/pglinter-${{ inputs.pgver }}'

- name: Upload DEB package to GitHub Releases
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: 'target/release/pglinter-${{ inputs.pgver }}/*.deb'
name: 'pglinter_${{ inputs.pgver }}-${{ github.ref_name }}.amd64.deb'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload RPM package to GitHub Releases
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: 'target/release/pglinter-${{ inputs.pgver }}/*.rpm'
name: 'pglinter_${{ inputs.pgver }}-${{ github.ref_name }}.x86_64.rpm'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

##
## R E L E A S E
##
release-packages:
name: 'release-packages-${{ inputs.pgver }}'
runs-on: ubuntu-latest
needs: [build, upload-packages]

# Only run on tags
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Create Release Entry
run: echo "Release ${{ github.ref_name }} created for ${{ inputs.pgver }}"
# Note: GitHub Releases are automatically created when using softprops/action-gh-release
# The actual release creation is handled by the upload-packages job
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Packages

on:
push:
tags:
- '*' # Triggers the workflow on any tag push
workflow_dispatch:
inputs:
pgver:
description: 'PostgreSQL version'
required: true
default: '16'


jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # This is crucial for uploading packages to GitHub Packages

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: built-packages # This should match the name from your 'build' job
path: target/release/anon-${{ inputs.pgver }}

- name: Upload .deb package to GitHub Packages
uses: actions/upload-artifact@v3
with:
name: postgresql_anonymizer_${{ inputs.pgver }}-${{ github.ref_name }}.amd64.deb
path: target/release/anon-${{ inputs.pgver }}/*.deb

- name: Upload .rpm package to GitHub Packages
uses: actions/upload-artifact@v3
with:
name: postgresql_anonymizer_${{ inputs.pgver }}-${{ github.ref_name }}.x86_64.rpm
path: target/release/anon-${{ inputs.pgver }}/*.rpm
80 changes: 0 additions & 80 deletions .github/workflows/precommit.yml

This file was deleted.

Loading
Loading