From 3ee503b1c439c87c09560a0a4b5c1396607dd5ae Mon Sep 17 00:00:00 2001 From: Bo Lu Date: Thu, 23 Jan 2025 16:03:11 +1100 Subject: [PATCH 1/3] ci: add Coveralls coverage report to CI --- .github/workflows/coverage.yml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..149826e9 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,39 @@ +name: Code Coverage + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: write + +jobs: + code-coverage: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.81.0 + components: llvm-tools-preview + + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Generate code coverage + id: coverage + run: | + cargo llvm-cov test --workspace --exclude supabase-wrappers-macros --no-fail-fast --lcov --output-path lcov.info + + - name: Coveralls upload + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: lcov.info + debug: true From 783ebe4b2621b3ab32af65a469f747d6575c8dd2 Mon Sep 17 00:00:00 2001 From: Bo Lu Date: Thu, 23 Jan 2025 16:15:30 +1100 Subject: [PATCH 2/3] ci: add pgrx setup steps --- .github/workflows/coverage.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 149826e9..ab54a1d0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -26,6 +26,31 @@ jobs: - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov + - run: | + sudo apt remove -y postgres* + sudo apt-get install -y wget gnupg + sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + sudo apt-get update -y -qq --fix-missing + sudo apt-get install -y \ + clang-10 \ + llvm-10 \ + clang \ + gcc \ + make \ + build-essential \ + libz-dev \ + zlib1g-dev \ + strace \ + libssl-dev \ + pkg-config \ + postgresql-15 \ + postgresql-server-dev-15 + sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/ + + - run: cargo install cargo-pgrx --version 0.12.7 + - run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config + - name: Generate code coverage id: coverage run: | From 2f72378444f255b52de63bfd38f5b8c7f63aac1b Mon Sep 17 00:00:00 2001 From: Bo Lu Date: Thu, 23 Jan 2025 16:19:36 +1100 Subject: [PATCH 3/3] fix ubuntu version to 20.04 --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ab54a1d0..961f78c6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,7 +12,7 @@ permissions: jobs: code-coverage: name: Code Coverage - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout code uses: actions/checkout@v4