This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Add general debug env flag for DB connection info #40
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: CI | |
| on: | |
| push: | |
| branches: [ modernize, main, master ] | |
| tags: ['*'] | |
| pull_request: | |
| branches: [ modernize, main, master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| db: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: paste | |
| POSTGRES_PASSWORD: paste | |
| POSTGRES_DB: paste | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U paste" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Perl | |
| uses: shogo82148/actions-setup-perl@v1 | |
| with: | |
| perl-version: "5.38" | |
| - name: Install PostgreSQL client | |
| run: sudo apt-get update && sudo apt-get install -y postgresql-client | |
| - name: Install dependencies | |
| run: | | |
| cpanm -n --installdeps . | |
| - name: Init test database schema | |
| env: | |
| PGPASSWORD: paste | |
| run: | | |
| psql -h localhost -U paste -d paste -f paste.sql | |
| if [ -f docker/langs.sql ]; then | |
| psql -h localhost -U paste -d paste -f docker/langs.sql | |
| fi | |
| sed 's/host=db/host=localhost/' t/conf/paste.conf > /tmp/paste.conf | |
| echo "[www]" >> /tmp/paste.conf | |
| echo "base_url = http://localhost:3000" >> /tmp/paste.conf | |
| cat /tmp/paste.conf | |
| - name: Lint/test | |
| env: | |
| PASTE_CONFIG: /tmp/paste.conf | |
| run: | | |
| PASTE_CONFIG=/tmp/paste.conf prove -v -Ilib t | |
| docker: | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to GHCR | |
| env: | |
| CR_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: echo "${CR_PAT}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build and push Docker image | |
| env: | |
| IMAGE_BASE: ghcr.io/${{ github.repository }} | |
| IMAGE_TAG: ${{ github.ref_name }} | |
| run: | | |
| docker build -t "${IMAGE_BASE}:${IMAGE_TAG}" -t "${IMAGE_BASE}:latest" . | |
| docker push "${IMAGE_BASE}:${IMAGE_TAG}" | |
| docker push "${IMAGE_BASE}:latest" |