diff --git a/.github/actions/artifact-from-cirrus/action.yaml b/.github/actions/artifact-from-cirrus/action.yaml deleted file mode 100644 index b0f82b6ec..000000000 --- a/.github/actions/artifact-from-cirrus/action.yaml +++ /dev/null @@ -1,119 +0,0 @@ -name: Artifact from Cirrus - -description: Waits for a specific Cirrus CI run to complete, then downloads the artifact and uploads it to the current workflow. This will silently succeed if Cirrus CI did not schedule a task within 2 minutes. - -inputs: - download: - description: Name of Artifact to download from Cirrus CI - required: true - task: - description: Name of Cirrus Task - required: true - token: - description: GitHub Token - required: true - upload: - description: Name of Artifact to upload on GitHub Actions - required: true - -runs: - using: composite - steps: - - shell: bash - run: echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" - - name: Wait for Check Suite to be created - id: check-suite - env: - # GITHUB_SHA does weird things for pull request, so we roll our own: - COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} - shell: bash - run: | - get_check_runs_url() { - gh api "repos/{owner}/{repo}/commits/${COMMIT}/check-suites" \ - | jq -r '.check_suites[] | select(.app.slug == "cirrus-ci") | .check_runs_url' - } - for _ in $(seq 1 12); do - check_runs_url="$(get_check_runs_url)" - if [ -z "$check_runs_url" ]; then - echo "Cirrus CI task has not started, yet. Waiting..." - sleep 10 - else - echo "check_runs_url=$check_runs_url" >> "$GITHUB_OUTPUT" - exit 0 - fi - done - >&2 echo "Cirrus CI check suite not found. Is Cirrus CI enabled for this repo?" - - name: Find task by name - id: find-task - if: steps.check-suite.outputs.check_runs_url - shell: bash - run: | - get_number_of_tasks() { - gh api "${{ steps.check-suite.outputs.check_runs_url }}" \ - | jq -r '.check_runs | map(select(.name == "${{ inputs.task }}")) | length' - } - tasks="$(get_number_of_tasks)" - case "$tasks" in - 0) - echo "Task not found, assuming it's skipped intentionally..." - exit 0 - ;; - 1) - echo "task_found=1" >> "$GITHUB_OUTPUT" - exit 0 - ;; - *) - >&2 echo "More than 1 task with the same name found. Don't know what to do..." - exit 1 - ;; - esac - - name: Wait for Cirrus CI to complete task - if: steps.find-task.outputs.task_found - shell: bash - run: | - get_conclusion() { - gh api "${{ steps.check-suite.outputs.check_runs_url }}" \ - | jq -r '.check_runs[] | select(.name == "${{ inputs.task }}" and .status == "completed") | .conclusion' - } - while true; do - conclusion="$(get_conclusion)" - if [ -z "$conclusion" ]; then - echo "Cirrus CI task has not completed, yet. Waiting..." - sleep 30 - else - if [ "$conclusion" == "success" ]; then - break - else - exit 1 - fi - fi - done - - name: Download artifact from Cirrus CI - if: steps.find-task.outputs.task_found - id: download - shell: bash - run: | - get_external_id() { - gh api "${{ steps.check-suite.outputs.check_runs_url }}" \ - | jq -er '.check_runs[] | select(.name == "${{ inputs.task }}") | .external_id' - } - archive="$(mktemp)" - artifacts="$(mktemp -d)" - until curl --no-progress-meter --fail -o "${archive}" \ - "https://api.cirrus-ci.com/v1/artifact/task/$(get_external_id)/${{ inputs.download }}.zip" - do - # This happens when a tag is pushed on the same commit. In this case the - # job is immediately marked as "completed" for us, so we end up here after a few - # seconds - but the actual Cirrus CI task is still running and didn't produce its artifact, yet. - echo "Artifact not found on Cirrus CI, yet. Waiting..." - sleep 30 - done - unzip "${archive}" -d "${artifacts}" - echo "artifacts=${artifacts}" >> "$GITHUB_OUTPUT" - - name: Save artifact to GitHub Actions - if: steps.find-task.outputs.task_found - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - with: - name: ${{ inputs.upload }} - path: ${{ steps.download.outputs.artifacts }} - if-no-files-found: error diff --git a/.github/actions/cache-on-main/action.yaml b/.github/actions/cache-on-main/action.yaml deleted file mode 100644 index 6b408063a..000000000 --- a/.github/actions/cache-on-main/action.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Cache on main - -description: Stores caches on main and release branches only, but restores them on all branches. - -inputs: - path: - description: Path(s) to cache - required: true - save-prs: - description: Whether to additionally store the cache in a pull request, too. Should only be used for very small caches. - type: boolean - prefix: - description: Cache key prefix to be used in both primary key and restore-keys. - required: true - suffix: - description: Cache key suffix to be used only in primary key. - required: true - -runs: - using: composite - steps: - - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - if: ${{ startsWith(github.ref, 'refs/heads/') || (inputs.save-prs && startsWith(github.ref, 'refs/pull/')) }} - with: - path: ${{ inputs.path }} - key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }} - restore-keys: | - ${{ runner.os }}-${{ inputs.prefix }}- - - uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - if: ${{ !startsWith(github.ref, 'refs/heads/') && !(inputs.save-prs && startsWith(github.ref, 'refs/pull/')) }} - with: - path: ${{ inputs.path }} - key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }} - restore-keys: | - ${{ runner.os }}-${{ inputs.prefix }}- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index ea6ea5ea9..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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - with: - name: postgrest-docker-x86-64 - path: postgrest-docker.tar.gz - if-no-files-found: error - - - macos: - name: Nix - MacOS - runs-on: macos-15 - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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 aarch64 - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - uses: haskell-actions/setup@dc63c94789664bb2910876ec3dfeeaa24d23b96b # v2.10.2 - with: - # This must match the version in stack.yaml's resolver - ghc-version: 9.6.7 - 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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.7', '9.8.4'] - fail-fast: false - name: Cabal - Linux x86-64 - GHC ${{ matrix.ghc }} - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - uses: haskell-actions/setup@dc63c94789664bb2910876ec3dfeeaa24d23b96b # v2.10.2 - with: - ghc-version: ${{ matrix.ghc }} - - name: Cache .cabal - uses: ./.github/actions/cache-on-main - with: - path: | - ~/.cabal/packages - ~/.cabal/store - prefix: cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - suffix: ${{ hashFiles('postgrest.cabal', 'cabal.project') }} - - 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 36c23e408..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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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 7b6946f8b..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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - 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/linkcheck.yaml b/.github/workflows/linkcheck.yaml deleted file mode 100644 index 66ddb0de3..000000000 --- a/.github/workflows/linkcheck.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Linkcheck - -on: - schedule: - - cron: '1 2 * * 3' - -jobs: - linkcheck: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: docs.linkcheck.bin - - run: postgrest-docs-linkcheck diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 76dbcc06d..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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - name: Download all artifacts - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - name: Download x86-64 Docker image - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - with: - name: postgrest-docker-x86-64 - - name: Download aarch64 binary - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - with: - name: postgrest-ubuntu-aarch64 - - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0 - 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 7f4047cdb..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,160 +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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 - 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: [12, 13, 14, 15, 16, 17] - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.testMemory.bin - - name: Run memory tests - run: postgrest-test-memory - - - loadtest: - strategy: - matrix: - kind: ['mixed', 'jwt'] - name: Loadtest - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - 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 -k ${{ matrix.kind }} "$TARGET_BRANCH" "$latest_tag" - postgrest-loadtest-report >> "$GITHUB_STEP_SUMMARY" - - flake: - strategy: - fail-fast: false - matrix: - runs-on: - - macos-14 # aarch64-darwin - - ubuntu-24.04 # x86_64-linux - - ubuntu-24.04-arm # aarch64-linux - name: Flake Check - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - fetch-depth: 0 - - name: Setup Nix Environment - uses: ./.github/actions/setup-nix - with: - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Run flake check - run: | - nix flake check