Skip to content

exp

exp #4

Workflow file for this run

name: ci

Check failure on line 1 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yaml

Invalid workflow file

(Line: 76, Col: 13): Unrecognized named-value: 'secrets'. Located at position 17 within expression: env.PUBLISH && (secrets.DOCKERHUB_TOKEN != '' || secrets.BOT_TOKEN != ''), (Line: 79, Col: 13): Unrecognized named-value: 'secrets'. Located at position 17 within expression: env.PUBLISH && (secrets.DOCKERHUB_TOKEN != '' || secrets.BOT_TOKEN != ''), (Line: 83, Col: 13): Unrecognized named-value: 'secrets'. Located at position 16 within expression: env.PUBLISH && secrets.DOCKERHUB_TOKEN != '', (Line: 91, Col: 13): Unrecognized named-value: 'secrets'. Located at position 16 within expression: env.PUBLISH && secrets.BOT_TOKEN != ''
on:
pull_request:
push:
branches:
- master
schedule:
# See https://crontab.guru/weekly
- cron: 0 0 * * 0
# Forks: change DOCKER_REPO to your image name (e.g. myuser/postgres-autoconf).
env:
DOCKER_REPO: tecnativa/postgres-autoconf
IS_PR: ${{ github.event_name == 'pull_request' }}
PUBLISH: ${{ github.ref == 'refs/heads/master' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
- name: Set PY
run: |
echo "PY=$(python -c 'import hashlib,sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v1.0.1
build-test-push:
runs-on: ubuntu-latest
needs: pre-commit
strategy:
fail-fast: false
matrix:
pg_version:
- "18"
- "17"
- "16"
- "15"
- "14"
- "13"
- "12"
- "11"
- "10"
- "9.6"
env:
# Tag equivalent to ${DOCKER_REPO}:latest (see hooks/push)
LATEST_RELEASE: "18-alpine"
DOCKER_TAG: ${{ matrix.pg_version }}-alpine
GIT_SHA1: ${{ github.sha }}
PG_VERSION: ${{ matrix.pg_version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
- run: pip install -r tests/ci-requirements.txt
# Build images
- run: ./hooks/build
# Test
- run: python -m unittest tests.test -v
- name: Set Docker Tag
run: |
if [ "${{ env.IS_PR }}" = "true" ]; then
echo "DOCKER_TAG=${{ matrix.pg_version }}-test-pr${{ github.event.number }}" >> $GITHUB_ENV
else
echo "DOCKER_TAG=${{ matrix.pg_version }}-alpine" >> $GITHUB_ENV
fi
- name: Tag Docker Image for PR
if: env.IS_PR
run: docker tag ${{ env.DOCKER_REPO }}:${{ matrix.pg_version }}-alpine ${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }}
- name: Set up QEMU
if: env.PUBLISH && (secrets.DOCKERHUB_TOKEN != '' || secrets.BOT_TOKEN != '')
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: env.PUBLISH && (secrets.DOCKERHUB_TOKEN != '' || secrets.BOT_TOKEN != '')
uses: docker/setup-buildx-action@v3
# Push
- name: Push Docker Image to Docker Hub
if: env.PUBLISH && secrets.DOCKERHUB_TOKEN != ''
env:
REGISTRY_HOST: docker.io
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_LOGIN }}
DOCKER_PLATFORM: linux/amd64,linux/arm64
run: ./hooks/push
- name: Push Docker Image to GitHub Registry
if: env.PUBLISH && secrets.BOT_TOKEN != ''
env:
REGISTRY_HOST: ghcr.io
REGISTRY_TOKEN: ${{ secrets.BOT_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.BOT_LOGIN }}
DOCKER_PLATFORM: linux/amd64,linux/arm64
run: ./hooks/push