-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use pgrx docker image to accelerate the dev-build/clippy/test
Signed-off-by: Keming <[email protected]>
- Loading branch information
Showing
2 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,41 +40,28 @@ jobs: | |
strategy: | ||
matrix: | ||
arch: ["x86_64", "aarch64"] | ||
env: | ||
PGRX_IMAGE: "kemingy/pgrx:0.12.6" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Set up dev 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 clang | ||
sudo apt-get install -y libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config | ||
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 | ||
rustup target add x86_64-unknown-linux-gnu | ||
rustup target add aarch64-unknown-linux-gnu | ||
- name: Cache | ||
uses: mozilla-actions/[email protected] | ||
- name: Set up pgrx | ||
- name: Set up docker images | ||
run: | | ||
cargo install cargo-pgrx --locked | ||
cargo pgrx init | ||
docker pull $PGRX_IMAGE | ||
- name: Clippy | ||
run: | | ||
for v in {12..17}; do | ||
cargo clippy --target ${{ matrix.arch }}-unknown-linux-gnu --features "pg$v" -- -D warnings | ||
for v in {14..17}; do | ||
docker run --rm -v .:/workspace $PGRX_IMAGE clippy --target ${{ matrix.arch }}-unknown-linux-gnu --features "pg$v" -- -D warnings | ||
done | ||
- name: Build | ||
run: | | ||
for v in {12..17}; do | ||
cargo build --lib --target ${{ matrix.arch }}-unknown-linux-gnu --features "pg$v" | ||
for v in {14..17}; do | ||
docker run --rm -v .:/workspace $PGRX_IMAGE build --lib --target ${{ matrix.arch }}-unknown-linux-gnu --features "pg$v" | ||
done | ||
- name: Test | ||
run: | | ||
# pg agnostic tests | ||
cargo test --no-fail-fast --target $ARCH-unknown-linux-gnu --features pg17 | ||
docker run --rm -v .:/workspace $PGRX_IMAGE test --no-fail-fast --target $ARCH-unknown-linux-gnu --features pg17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG PGRX_VERSION=0.12.6 | ||
ARG RUSTC_WRAPPER=sccache | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
LANG=en_US.UTF-8 \ | ||
LC_ALL=en_US.UTF-8 \ | ||
RUSTC_WRAPPER=${RUSTC_WRAPPER} \ | ||
RUSTFLAGS="-Dwarnings" | ||
|
||
RUN apt update && \ | ||
apt install -y --no-install-recommends \ | ||
curl \ | ||
ca-certificates \ | ||
build-essential \ | ||
crossbuild-essential-arm64 \ | ||
qemu-user-static \ | ||
libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config \ | ||
clang && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
USER ubuntu | ||
ENV PATH="$PATH:/home/ubuntu/.cargo/bin" | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=none -y | ||
|
||
WORKDIR /workspace | ||
COPY rust-toolchain.toml /workspace/rust-toolchain.toml | ||
RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu | ||
|
||
RUN cargo install cargo-pgrx --locked --version=${PGRX_VERSION} && \ | ||
cargo pgrx init | ||
|
||
ENTRYPOINT [ "cargo" ] |