Skip to content

Commit

Permalink
ci: do not run rust test 3 times
Browse files Browse the repository at this point in the history
Signed-off-by: usamoi <[email protected]>
  • Loading branch information
usamoi committed Mar 26, 2024
1 parent f4998e4 commit 67572c7
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PostgreSQL check
name: PostgreSQL

on:
push:
Expand Down Expand Up @@ -44,7 +44,7 @@ env:
RUSTFLAGS: "-Dwarnings"

jobs:
check:
test:
strategy:
matrix:
version: [14, 15, 16]
Expand Down
65 changes: 63 additions & 2 deletions .github/workflows/rust_check.yml → .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust check
name: Rust

on:
push:
Expand Down Expand Up @@ -101,6 +101,67 @@ jobs:
run: cargo clippy --no-default-features --features "pg$VERSION" --target $ARCH-unknown-linux-gnu
- name: Build
run: cargo build --no-default-features --features "pg$VERSION" --target $ARCH-unknown-linux-gnu
- name: Post Set up Cache
uses: actions/cache/save@v4
if: ${{ !steps.cache.outputs.cache-hit }}
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.version }}-${{ matrix.arch }}
test:
strategy:
matrix:
arch: ["x86_64", "aarch64"]
runs-on: ubuntu-latest
env:
SEMVER: "0.0.0"
VERSION: "16"
ARCH: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Environment
run: |
sudo apt-get remove -y '^postgres.*' '^libpq.*' '^clang.*' '^llvm.*' '^libclang.*' '^libllvm.*' '^mono-llvm.*'
sudo apt-get purge -y '^postgres.*' '^libpq.*' '^clang.*' '^llvm.*' '^libclang.*' '^libllvm.*' '^mono-llvm.*'
sudo apt-get update
sudo apt-get install -y build-essential crossbuild-essential-arm64
sudo apt-get install -y qemu-user-static
touch ~/.cargo/config.toml
echo 'target.aarch64-unknown-linux-gnu.linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
echo 'target.aarch64-unknown-linux-gnu.runner = ["qemu-aarch64-static", "-L", "/usr/aarch64-linux-gnu"]' >> ~/.cargo/config.toml
- name: Set up Sccache
uses: mozilla-actions/[email protected]
- name: Set up Cache
uses: actions/cache/restore@v4
id: cache
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.arch }}
- name: Set up Clang-16
run: |
sudo sh -c 'echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-16 main" >> /etc/apt/sources.list'
wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y clang-16
- name: Set up Pgrx
run: |
# pg_config
mkdir -p ~/.pg_config
touch ~/.pg_config/pg_config
chmod 777 ~/.pg_config/pg_config
echo "#!/usr/bin/env bash" >> ~/.pg_config/pg_config
echo "$(pwd)/tools/pg_config.sh \"\$@\" < $(pwd)/vendor/pg_config/pg${VERSION}_${ARCH}-unknown-linux-gnu.txt" >> ~/.pg_config/pg_config
mkdir -p ~/.pgrx && echo "configs.pg$VERSION=\"$HOME/.pg_config/pg_config\"" > ~/.pgrx/config.toml
# pgrx_binding
mkdir -p ~/.pgrx_binding
cp ./vendor/pgrx_binding/pg${VERSION}_$(uname --machine)-unknown-linux-gnu.rs ~/.pgrx_binding/pg${VERSION}_raw_bindings.rs
echo PGRX_TARGET_INFO_PATH_PG$VERSION=$HOME/.pgrx_binding >> "$GITHUB_ENV"
- name: Test
run: cargo test --all --no-fail-fast --no-default-features --features "pg$VERSION" --target $ARCH-unknown-linux-gnu -- --nocapture
- name: Test (x86_64)
Expand All @@ -118,4 +179,4 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.version }}-${{ matrix.arch }}
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.arch }}

0 comments on commit 67572c7

Please sign in to comment.