1- name : CI lints and tests
1+ name : Build and tests
22on :
33 push :
44 branches : [ "main" ]
1717
1818jobs :
1919 build-and-test :
20- runs-on : ubuntu-latest
2120 strategy :
2221 matrix :
2322 postgres : [ 14, 15, 16, 17 ]
23+ runs_on : [ 'ubuntu-22.04', 'ubuntu-22.04-arm' ]
24+ include :
25+ - runs_on : ubuntu-22.04
26+ arch : x64
27+ - runs_on : ubuntu-22.04-arm
28+ arch : arm64
29+
30+ runs-on : ${{ matrix.runs_on }}
31+
2432 env :
2533 PG_MAJOR : ${{ matrix.postgres }}
34+ PG_CONFIG : /usr/lib/postgresql/${{ matrix.postgres }}/bin/pg_config
2635
2736 steps :
2837 - uses : actions/checkout@v4
2938
30- - name : Set up sccache
39+ - name : Set up sccache for x86_64
40+ if : ${{ matrix.arch == 'x64' }}
3141 run : |
3242 wget https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz
3343 tar -xzf sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz
@@ -38,13 +48,34 @@ jobs:
3848 SCCACHE_VERSION : 0.8.1
3949 SCCACHE_SHA256 : " 7203a4dcb3a67f3a0272366d50ede22e5faa3e2a798deaa4d1ea377b51c0ab0c"
4050
41- - name : Set up Rust
51+ - name : Set up sccache for arm64
52+ if : ${{ matrix.arch == 'arm64' }}
53+ run : |
54+ wget https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/sccache-v$SCCACHE_VERSION-aarch64-unknown-linux-musl.tar.gz
55+ tar -xzf sccache-v$SCCACHE_VERSION-aarch64-unknown-linux-musl.tar.gz
56+ sudo mv sccache-v$SCCACHE_VERSION-aarch64-unknown-linux-musl/sccache /usr/local/bin
57+ chmod +x /usr/local/bin/sccache
58+ echo "$SCCACHE_SHA256 /usr/local/bin/sccache" | sha256sum --check
59+ env :
60+ SCCACHE_VERSION : 0.8.1
61+ SCCACHE_SHA256 : " 36b2fd1c6c3a104ec1d526edb0533a3827c266054bf4552fb97f524beff6a612"
62+
63+ - name : Set up Rust for x86_64
64+ if : ${{ matrix.arch == 'x64' }}
4265 uses : dtolnay/rust-toolchain@stable
4366 with :
4467 toolchain : 1.86.0
4568 target : x86_64-unknown-linux-gnu
4669 components : rustfmt, clippy, llvm-tools-preview
4770
71+ - name : Set up Rust for arm64
72+ if : ${{ matrix.arch == 'arm64' }}
73+ uses : dtolnay/rust-toolchain@stable
74+ with :
75+ toolchain : 1.86.0
76+ target : aarch64-unknown-linux-gnu
77+ components : rustfmt, clippy, llvm-tools-preview
78+
4879 - name : Cache cargo registry
4980 uses : actions/cache@v4
5081 continue-on-error : false
@@ -56,21 +87,14 @@ jobs:
5687 ~/.cargo/registry/index
5788 ~/.cargo/registry/cache
5889 ~/.cargo/git/db
59- key : pg_parquet-rust-cache-${{ runner.os }}-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
90+ key : pg_parquet-rust-cache-${{ runner.arch }}-${{ runner. os }}-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
6091
6192 - name : Cache sccache directory
6293 uses : actions/cache@v4
6394 continue-on-error : false
6495 with :
6596 path : ${{ env.SCCACHE_DIR }}
66- key : pg_parquet-sccache-cache-${{ runner.os }}-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
67-
68- - name : Export environment variables from .env file
69- uses : falti/dotenv-action@v1
70- with :
71- path : .devcontainer/.env
72- export-variables : true
73- keys-case : bypass
97+ key : pg_parquet-sccache-cache-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('Cargo.lock', '.github/workflows/ci.yml') }}
7498
7599 - name : Install PostgreSQL
76100 run : |
@@ -96,95 +120,36 @@ jobs:
96120 echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
97121 sudo apt-get update && sudo apt-get install -y azure-cli
98122
99- - name : Install and configure pgrx
123+ - name : Install pgrx
100124 run : |
101125 cargo install --locked [email protected] 102- cargo pgrx init --pg${{ env.PG_MAJOR }} /usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config \
103- --base-testing-port $PGRX_TEST_PG_BASE_PORT
104126
105127 - name : Install cargo-llvm-cov for coverage report
106128 run :
cargo install --locked [email protected] 107129
108- - name : Format and lint
109- run : |
110- cargo fmt --all -- --check
111- cargo clippy --all-targets --features "pg${{ env.PG_MAJOR }}, pg_test" --no-default-features -- -D warnings
112-
113130 - name : Set up permissions for PostgreSQL
114131 run : |
115132 sudo chmod a+rwx $(/usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config --pkglibdir) \
116133 $(/usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config --sharedir)/extension \
117134 /var/run/postgresql/
118135
119- - name : Start Minio for s3 emulator tests
120- run : |
121- docker run -d \
122- --env-file .devcontainer/.env \
123- -p 9000:9000 \
124- --entrypoint "./entrypoint.sh" \
125- --volume ./.devcontainer/minio-entrypoint.sh:/entrypoint.sh \
126- minio/minio
127-
128- while ! curl $AWS_ENDPOINT_URL; do
129- echo "Waiting for $AWS_ENDPOINT_URL..."
130- sleep 1
131- done
132-
133- - name : Start Azurite for Azure Blob Storage emulator tests
134- run : |
135- docker run -d \
136- --env-file .devcontainer/.env \
137- -p 10000:10000 \
138- mcr.microsoft.com/azure-storage/azurite
139-
140- while ! curl $AZURE_STORAGE_ENDPOINT; do
141- echo "Waiting for $AZURE_STORAGE_ENDPOINT..."
142- sleep 1
143- done
144-
145- # create container
146- az storage container create -n $AZURE_TEST_CONTAINER_NAME --connection-string $AZURE_STORAGE_CONNECTION_STRING
147- az storage container create -n ${AZURE_TEST_CONTAINER_NAME}2 --connection-string $AZURE_STORAGE_CONNECTION_STRING
148-
149- - name : Start local web server for http(s) tests
136+ - name : Check format and lint
150137 run : |
151- docker run -d \
152- --env-file .devcontainer/.env \
153- -p 8080:80 \
154- rclone/rclone serve webdav /data --addr :80
138+ make check-format
139+ make check-lint
155140
156- while ! curl $HTTP_ENDPOINT; do
157- echo "Waiting for $HTTP_ENDPOINT..."
158- sleep 1
159- done
160-
161- - name : Start fake-gcs-server for Google Cloud Storage emulator tests
141+ - name : Run tests without coverage
142+ if : ${{ env.PG_MAJOR != '17' || matrix.arch != 'x64' }}
162143 run : |
163- docker run -d \
164- --env-file .devcontainer/.env \
165- -p 4443:4443 \
166- tustvold/fake-gcs-server -scheme http -public-host localhost:4443
167-
168- while ! curl $GOOGLE_SERVICE_ENDPOINT; do
169- echo "Waiting for $GOOGLE_SERVICE_ENDPOINT..."
170- sleep 1
171- done
172-
173- # create bucket
174- curl -v -X POST --data-binary "{\"name\":\"$GOOGLE_TEST_BUCKET\"}" -H "Content-Type: application/json" "$GOOGLE_SERVICE_ENDPOINT/storage/v1/b"
175- curl -v -X POST --data-binary "{\"name\":\"${GOOGLE_TEST_BUCKET}2\"}" -H "Content-Type: application/json" "$GOOGLE_SERVICE_ENDPOINT/storage/v1/b"
144+ make check
176145
177- - name : Run tests
146+ - name : Run tests with coverage
147+ if : ${{ env.PG_MAJOR == '17' && matrix.arch == 'x64' }}
178148 run : |
179- # Run tests with coverage tool
180- source <(cargo llvm-cov show-env --export-prefix)
181- cargo llvm-cov clean
182- cargo build --features "pg${{ env.PG_MAJOR }}, pg_test" --no-default-features
183- cargo pgrx test pg${{ env.PG_MAJOR }} --no-default-features
184- cargo llvm-cov report --lcov > lcov.info
149+ make check-with-coverage
185150
186151 - name : Upload coverage report to Codecov
187- if : ${{ env.PG_MAJOR }} == 17
152+ if : ${{ env.PG_MAJOR == '17' && matrix.arch == 'x64' }}
188153 uses : codecov/codecov-action@v4
189154 with :
190155 fail_ci_if_error : true
0 commit comments