From 8f8efbaa12d108014595e13dc32ad75d6ee87b25 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 5 Jul 2025 22:18:19 +0200 Subject: [PATCH] ci: disable all CI except docs IO tests fail randomly and we don't need to run everything if we only ever update the docs on this branch from now on. --- .github/workflows/build.yaml | 201 -------------------------------- .github/workflows/check.yaml | 32 ------ .github/workflows/ci.yaml | 70 ------------ .github/workflows/docs.yaml | 8 +- .github/workflows/release.yaml | 202 --------------------------------- .github/workflows/test.yaml | 135 ---------------------- 6 files changed, 4 insertions(+), 644 deletions(-) delete mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/check.yaml delete mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index cd80f1bae..000000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,201 +0,0 @@ -name: Build - -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: false - pull_request: - branches: - - main - - v[0-9]+ - paths: - - .github/workflows/build.yaml - - .github/actions/** - - .github/scripts/** - - .github/* - - '*.nix' - - nix/** - - .cirrus.yml - - cabal.project* - - postgrest.cabal - - stack.yaml* - - '**.hs' - - '!**.md' - -concurrency: - # Terminate all previous runs of the same workflow for pull requests - group: build-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - static: - name: Nix - Linux x86-64 static - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - - name: Build static executable - run: nix-build -A postgrestStatic - - name: Save built executable as artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: postgrest-linux-static-x86-64 - path: result/bin/postgrest - if-no-files-found: error - - - name: Build Docker image - run: nix-build -A docker.image --out-link postgrest-docker.tar.gz - - name: Save built Docker image as artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: postgrest-docker-x86-64 - path: postgrest-docker.tar.gz - if-no-files-found: error - - - macos: - name: Nix - MacOS - runs-on: macos-14 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Install gnu sed - run: brew install gnu-sed - - - name: Build everything - run: | - # The --dry-run will give us a list of derivations to download from cachix and - # derivations to build. We only take those that would have to be built and then build - # those explicitly. This has the advantage that pure verification will not include - # a download anymore, making it much faster. If something needs to be built, only - # the dependencies required to do so will be downloaded, but not everything. - nix-build --dry-run 2>&1 \ - | gsed -e '1,/derivations will be built:$/d' -e '/paths will be fetched/Q' \ - | xargs nix-build - - - stack: - strategy: - fail-fast: false - matrix: - include: - - name: Linux aarch64 - runs-on: ubuntu-24.04-arm - cache: | - ~/.stack/pantry - ~/.stack/snapshots - ~/.stack/stack.sqlite3 - artifact: postgrest-ubuntu-aarch64 - deps: sudo apt-get update && sudo apt-get install libpq-dev - - - name: MacOS - runs-on: macos-14 - cache: | - ~/.stack/pantry - ~/.stack/snapshots - ~/.stack/stack.sqlite3 - artifact: postgrest-macos-aarch64 - deps: brew link --force libpq - - - name: Windows - runs-on: windows-2022 - cache: | - C:\sr\pantry - C:\sr\snapshots - C:\sr\stack.sqlite3 - deps: Add-Content $env:GITHUB_PATH $env:PGBIN - artifact: postgrest-windows-x86-64 - - name: Stack - ${{ matrix.name }} - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: haskell-actions/setup@d9b5b3fcf7ca56b8fe585c9b77d3b0ce466affd2 # v2.7.10 - with: - # This must match the version in stack.yaml's resolver - ghc-version: 9.6.5 - enable-stack: true - stack-no-global: true - stack-setup-ghc: true - - name: Cache ~/.stack - uses: ./.github/actions/cache-on-main - with: - path: ${{ matrix.cache }} - prefix: stack - suffix: ${{ hashFiles('postgrest.cabal', 'stack.yaml.lock') }} - - name: Cache .stack-work - uses: ./.github/actions/cache-on-main - with: - path: .stack-work - save-prs: true - prefix: stack-work-${{ hashFiles('postgrest.cabal', 'stack.yaml.lock') }} - suffix: ${{ hashFiles('main/**/*.hs', 'src/**/*.hs') }} - - name: Install dependencies - if: matrix.deps - run: ${{ matrix.deps }} - - name: Build with Stack - run: stack build --lock-file error-on-write --local-bin-path result --copy-bins - - name: Strip Executable - run: strip result/postgrest* - - name: Save built executable as artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: ${{ matrix.artifact }} - path: | - result/postgrest - result/postgrest.exe - if-no-files-found: error - - - freebsd: - name: Stack - FreeBSD from CirrusCI - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: ./.github/actions/artifact-from-cirrus - with: - token: ${{ github.token }} - task: Build FreeBSD (Stack) - download: bin - upload: postgrest-freebsd-x86-64 - - - cabal: - strategy: - matrix: - ghc: ['9.6.4', '9.8.2'] - fail-fast: false - name: Cabal - Linux x86-64 - GHC ${{ matrix.ghc }} - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: haskell-actions/setup@d9b5b3fcf7ca56b8fe585c9b77d3b0ce466affd2 # v2.7.10 - with: - ghc-version: ${{ matrix.ghc }} - - name: Cache .cabal - uses: ./.github/actions/cache-on-main - with: - path: | - ~/.cabal/packages - ~/.cabal/store - prefix: cabal-${{ matrix.ghc }} - suffix: ${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }} - - name: Cache dist-newstyle - uses: ./.github/actions/cache-on-main - with: - path: dist-newstyle - save-prs: true - prefix: cabal-${{ matrix.ghc }}-dist-newstyle-${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }} - suffix: ${{ hashFiles('**/*.hs') }} - - name: Install dependencies - run: cabal build --only-dependencies --enable-tests --enable-benchmarks - - name: Build - run: cabal build --enable-tests --enable-benchmarks all diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml deleted file mode 100644 index 733d6b0da..000000000 --- a/.github/workflows/check.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Check - -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: false - pull_request: - branches: - - main - - v[0-9]+ - -concurrency: - # Terminate all previous runs of the same workflow for pull requests - group: style-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - lint-style: - name: Lint & Style - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: style.lint.bin style.styleCheck.bin - - name: Run linter (check locally with `nix-shell --run postgrest-lint`) - run: postgrest-lint - - name: Run style check (auto-format with `nix-shell --run postgrest-style`) - run: postgrest-style-check diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 36ee96b5f..000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: CI - -on: - push: - branches: - - main - - v[0-9]+ - -jobs: - check: - name: Check - uses: ./.github/workflows/check.yaml - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - docs: - name: Docs - uses: ./.github/workflows/docs.yaml - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - test: - name: Test - uses: ./.github/workflows/test.yaml - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - build: - name: Build - uses: ./.github/workflows/build.yaml - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - tag: - name: Tag - concurrency: - # Never tag outdated commits on the main branch by skipping superseded commits - group: ci-tag-${{ (github.ref == 'refs/heads/main' && github.ref) || github.run_id }} - # TODO: Enable this once https://github.com/orgs/community/discussions/13015 is solved - cancel-in-progress: false - if: vars.RELEASE_ENABLED - runs-on: ubuntu-24.04 - needs: - - docs - - test - - build - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - ssh-key: ${{ secrets.POSTGREST_SSH_KEY }} - - name: Tag latest commit - run: | - cabal_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)" - - if [[ "$cabal_version" == *.*.* ]]; then - git fetch --tags - - if [ -z "$(git tag --list "v$cabal_version")" ]; then - git tag "v$cabal_version" - git push origin "v$cabal_version" - fi - else - git tag -f "devel" - git push -f origin "devel" - fi diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 3b99d18a6..97bc86275 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,10 +1,10 @@ name: Docs on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: false + push: + branches: + - main + - v[0-9]+ pull_request: branches: - main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index ba8f20736..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,202 +0,0 @@ -name: Release - -on: - push: - tags: - - devel - - v* - -concurrency: - # Terminate all previous runs of the same workflow for the same tag. - group: release-${{ github.ref }} - # TODO: Enable this once https://github.com/orgs/community/discussions/13015 is solved - cancel-in-progress: false - -jobs: - build: - name: Build - uses: ./.github/workflows/build.yaml - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - prepare: - name: Prepare - runs-on: ubuntu-24.04 - needs: - - build - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Check the version to be released - run: | - cabal_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)" - - if [ "${GITHUB_REF_NAME}" != "devel" ] && [ "${GITHUB_REF_NAME}" != "v$cabal_version" ]; then - echo "Tagged version ($GITHUB_REF_NAME) does not match the one in postgrest.cabal (v$cabal_version). Aborting release..." - exit 1 - fi - - name: Identify changes from CHANGELOG.md - run: | - if [ "${GITHUB_REF_NAME}" == "devel" ]; then - echo "Getting unreleased changes..." - sed -n "1,/## Unreleased/d;/## \[/q;p" CHANGELOG.md > CHANGES.md - else - version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)" - echo "Propper release, getting changes for version $version ..." - sed -n "1,/## \[$version\]/d;/## \[/q;p" CHANGELOG.md > CHANGES.md - fi - - echo "Relevant extract from CHANGELOG.md:" - cat CHANGES.md - - name: Save CHANGES.md as artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: release-changes - path: CHANGES.md - if-no-files-found: error - - - github: - name: GitHub - permissions: - contents: write - runs-on: ubuntu-24.04 - needs: - - prepare - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Download all artifacts - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 - with: - path: artifacts - - name: Create release bundle with archives for all builds - run: | - find artifacts -type f -iname postgrest -exec chmod +x {} \; - - mkdir -p release-bundle - - tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-linux-static-x86-64.tar.xz" \ - -C artifacts/postgrest-linux-static-x86-64 postgrest - - tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-macos-aarch64.tar.xz" \ - -C artifacts/postgrest-macos-aarch64 postgrest - - tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-freebsd-x86-64.tar.xz" \ - -C artifacts/postgrest-freebsd-x86-64 postgrest - - tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-ubuntu-aarch64.tar.xz" \ - -C artifacts/postgrest-ubuntu-aarch64 postgrest - - zip --junk-paths "release-bundle/postgrest-${GITHUB_REF_NAME}-windows-x86-64.zip" \ - artifacts/postgrest-windows-x86-64/postgrest.exe - - - name: Save release bundle - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: release-bundle - path: release-bundle - if-no-files-found: error - - - name: Publish release on GitHub - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Releasing version ${GITHUB_REF_NAME} on GitHub..." - - if [ "${GITHUB_REF_NAME}" == "devel" ]; then - # To replace the existing release, we must first delete the old assets, - # then modify the release, then add the new assets. - gh release view devel --json assets \ - | jq -r '.assets[] | .name' \ - | xargs -rn1 \ - gh release delete-asset -y devel - gh release edit devel \ - -t devel \ - --verify-tag \ - -F artifacts/release-changes/CHANGES.md \ - --prerelease - gh release upload --clobber devel release-bundle/* - else - gh release create "${GITHUB_REF_NAME}" \ - -t "${GITHUB_REF_NAME}" \ - --verify-tag \ - -F artifacts/release-changes/CHANGES.md \ - release-bundle/* - fi - - - docker: - name: Docker Hub - runs-on: ubuntu-24.04-arm - needs: - - prepare - if: | - vars.DOCKER_REPO && vars.DOCKER_USER - env: - DOCKER_REPO: ${{ vars.DOCKER_REPO }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Download x86-64 Docker image - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 - with: - name: postgrest-docker-x86-64 - - name: Download aarch64 binary - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 - with: - name: postgrest-ubuntu-aarch64 - - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 - - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 - with: - username: ${{ vars.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} - - name: Build aarch64 Docker image - run: | - # This only pushes the image via digest, not a tag. This will not appear - # in the image list on Docker Hub, yet. It will be later added to the main - # tag's manifest. - docker buildx build \ - -t "$DOCKER_REPO/postgrest" \ - --platform linux/arm64 \ - --output push-by-digest=true,type=image,push=true \ - --metadata-file metadata.json \ - . - echo "SHA256_ARM=$(jq -r '."containerimage.digest"' metadata.json)" >> "$GITHUB_ENV" - - name: Publish images on Docker Hub - run: | - docker load -i postgrest-docker.tar.gz - - docker tag postgrest:latest "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" - docker push "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" - docker buildx imagetools create --append \ - -t "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" \ - "$DOCKER_REPO/postgrest@$SHA256_ARM" - - # Only tag 'latest' for full releases - if [ "${GITHUB_REF_NAME}" != "devel" ]; then - echo "Pushing to 'latest' tag for full release of ${GITHUB_REF_NAME} ..." - docker tag postgrest:latest "$DOCKER_REPO"/postgrest:latest - docker push "$DOCKER_REPO"/postgrest:latest - docker buildx imagetools create --append \ - -t "$DOCKER_REPO/postgrest:latest" \ - "$DOCKER_REPO/postgrest@$SHA256_ARM" - else - echo "Skipping push to 'latest' tag for pre-release..." - fi - - - docker-description: - name: Docker Hub Description - runs-on: ubuntu-24.04 - if: | - vars.DOCKER_REPO && vars.DOCKER_USER && - github.ref == 'refs/tags/devel' - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: peter-evans/dockerhub-description@432a30c9e07499fd01da9f8a49f0faf9e0ca5b77 # v4.0.2 - with: - username: ${{ vars.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} - repository: ${{ vars.DOCKER_REPO }}/postgrest - short-description: ${{ github.event.repository.description }} - readme-filepath: ./docker-hub-readme.md - diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 4a03c216e..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,135 +0,0 @@ -name: Test - -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: false - CODECOV_TOKEN: - required: false - pull_request: - branches: - - main - - v[0-9]+ - paths: - - .github/workflows/test.yaml - - .github/workflows/report.yaml - - .github/actions/setup-nix/** - - default.nix - - nix/** - - .stylish-haskell.yaml - - cabal.project - - postgrest.cabal - - '**.hs' - - test/** - - '!**.md' - -concurrency: - # Terminate all previous runs of the same workflow for pull requests - group: test-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - coverage: - name: Coverage - runs-on: ubuntu-24.04 - defaults: - run: - # Hack for enabling color output, see: - # https://github.com/actions/runner/issues/241#issuecomment-842566950 - shell: script -qec "bash --noprofile --norc -eo pipefail {0}" - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.coverage.bin tests.testDoctests.bin tests.testSpecIdempotence.bin - - - name: Run coverage (IO tests and Spec tests against PostgreSQL 15) - run: postgrest-coverage - - name: Upload coverage to codecov - uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 - with: - files: ./coverage/codecov.json - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Run doctests - if: always() - run: postgrest-test-doctests - - - name: Check the spec tests for idempotence - if: always() - run: postgrest-test-spec-idempotence - - - postgres: - strategy: - fail-fast: false - matrix: - pgVersion: ["9_6", 10, 11, 12, 13, 14, 15, 16] - name: PG ${{ matrix.pgVersion }} - runs-on: ubuntu-24.04 - defaults: - run: - # Hack for enabling color output, see: - # https://github.com/actions/runner/issues/241#issuecomment-842566950 - shell: script -qec "bash --noprofile --norc -eo pipefail {0}" - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.postgresql-${{ matrix.pgVersion }}.bin - - - name: Run spec tests - if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-spec - - - name: Run IO tests - if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-io -vv - - - name: Run IO tests on a big schema - if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-big-schema -vv - - - memory: - name: Memory - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: memory.test.bin - - name: Run memory tests - run: postgrest-test-memory - - - loadtest: - name: Loadtest - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: loadtest.loadtestAgainst.bin loadtest.report.bin - - name: Run loadtest - env: - TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} - run: | - if [ "$TARGET_BRANCH" = "main" ]; then - latest_tag=$(git tag --sort=-creatordate --list "v*" | head -n1) - else - latest_tag=$(git tag --merged HEAD --sort=-creatordate "v*" | head -n1) - fi - postgrest-loadtest-against "$TARGET_BRANCH" "$latest_tag" - postgrest-loadtest-report >> "$GITHUB_STEP_SUMMARY"