Skip to content

Commit a959942

Browse files
committed
chore: adapt CI workflows & scripts
1 parent 089afdd commit a959942

File tree

6 files changed

+336
-207
lines changed

6 files changed

+336
-207
lines changed

.github/release-drafter.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Uses Conventional Commits to decide semver + group sections
2+
name-template: 'v$RESOLVED_VERSION'
3+
tag-template: 'v$RESOLVED_VERSION'
4+
5+
template: |
6+
## 🚀 Features
7+
$CHANGES
8+
_(Automatically generated from Conventional Commits)_
9+
10+
version-resolver:
11+
major:
12+
- '^.*!:' # breaking changes
13+
minor:
14+
- '^feat'
15+
patch:
16+
- '^fix'
17+
- '^refactor'
18+
- '^perf'
19+
default: patch
20+
21+
# Show each change as “- commit-title (#PR) by @author”
22+
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
23+
24+
# Optional: if nothing matched
25+
no-changes-template: '- Internal improvements only'

.github/workflows/ci.yaml

Lines changed: 5 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
- next
77
pull_request:
88
branches:
99
- main
10+
- next
1011

1112
env:
1213
CARGO_TERM_COLOR: always
@@ -26,6 +27,8 @@ jobs:
2627
RUSTC_WRAPPER: sccache
2728
SCCACHE_DIR: /home/runner/.cache/sccache
2829
RUST_TOOLCHAIN: ${{ matrix.rust || 'stable' }}
30+
# Github token is there to avoid hitting the rate limits (which does happen for some reason when querying the latest release)
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2932
steps:
3033
- uses: actions/checkout@v4
3134
- name: Set up Rust
@@ -198,88 +201,4 @@ jobs:
198201
- name: Checkout code
199202
uses: actions/checkout@v4
200203
- name: Run rustfmt
201-
run: cargo fmt -- --check
202-
Migration:
203-
runs-on: ubuntu-latest
204-
steps:
205-
- uses: actions/checkout@v4
206-
207-
- name: Install PostgreSQL
208-
run: |
209-
sudo apt-get update
210-
sudo apt-get install -y wget gnupg
211-
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
212-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
213-
sudo apt-get update -y -qq --fix-missing
214-
sudo apt-get install postgresql-16 postgresql-server-dev-16
215-
216-
- name: Install cargo-pgrx
217-
run: |
218-
PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
219-
cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
220-
cargo pgrx init --pg16 $(which pg_config)
221-
222-
- name: Build and install current version
223-
run: |
224-
# Build and install the current version which supports both v0.1.0 and v0.2.0
225-
cargo pgrx package --features pg16 --pg-config $(which pg_config)
226-
227-
# Install the manual SQL files for migration testing
228-
sudo cp sql/typeid--0.1.0.sql /usr/share/postgresql/16/extension/
229-
sudo cp sql/typeid--0.1.0--0.2.0.sql /usr/share/postgresql/16/extension/
230-
sudo cp sql/typeid--0.2.0.sql /usr/share/postgresql/16/extension/
231-
232-
sudo cp target/release/typeid-pg16/usr/share/postgresql/16/extension/* /usr/share/postgresql/16/extension/
233-
sudo cp target/release/typeid-pg16/usr/lib/postgresql/16/lib/* /usr/lib/postgresql/16/lib/
234-
235-
- name: Start PostgreSQL and create test database
236-
run: |
237-
sudo systemctl start postgresql.service
238-
sudo -u postgres createuser -s -d -r -w runner
239-
createdb -U runner test_migration
240-
241-
- name: Install v0.1.0 and create test data
242-
run: |
243-
psql -U runner -d test_migration -c "CREATE EXTENSION typeid VERSION '0.1.0';"
244-
psql -U runner -d test_migration -c "
245-
CREATE TABLE migration_test (id typeid, name text);
246-
INSERT INTO migration_test VALUES
247-
(typeid_generate('user'), 'Alice'),
248-
(typeid_generate('admin'), 'Bob'),
249-
(typeid_generate(''), 'Anonymous');
250-
"
251-
# Verify v0.1.0 works
252-
psql -U runner -d test_migration -c "SELECT COUNT(*) FROM migration_test;"
253-
254-
- name: Verify extension files are installed
255-
run: |
256-
# Check that all extension files are properly installed
257-
echo "=== Extension SQL files ==="
258-
ls -la /usr/share/postgresql/16/extension/typeid*
259-
echo "=== Extension library ==="
260-
ls -la /usr/lib/postgresql/16/lib/typeid*
261-
echo "=== Available versions ==="
262-
cat /usr/share/postgresql/16/extension/typeid.control
263-
264-
- name: Run migration to v0.2.0
265-
run: |
266-
psql -U runner -d test_migration -c "ALTER EXTENSION typeid UPDATE TO '0.2.0';"
267-
psql -U runner -d test_migration -c "SELECT extversion FROM pg_extension WHERE extname = 'typeid';"
268-
269-
- name: Verify migration worked
270-
run: |
271-
# Test old data still works
272-
psql -U runner -d test_migration -c "SELECT COUNT(*) FROM migration_test;"
273-
psql -U runner -d test_migration -c "SELECT typeid_prefix(id) FROM migration_test;"
274-
275-
# Test new v0.2.0 functions work
276-
psql -U runner -d test_migration -c "SELECT typeid_generate_nil();"
277-
psql -U runner -d test_migration -c "SELECT typeid_is_valid('user_01h455vb4pex5vsknk084sn02q');"
278-
psql -U runner -d test_migration -c "SELECT COUNT(*) FROM migration_test WHERE id @> 'user';"
279-
psql -U runner -d test_migration -c "SELECT typeid_has_prefix(typeid_generate('test'), 'test');"
280-
281-
# Test that old and new work together
282-
psql -U runner -d test_migration -c "
283-
INSERT INTO migration_test VALUES (typeid_generate_nil(), 'NewUser');
284-
SELECT COUNT(*) FROM migration_test WHERE typeid_is_nil_prefix(id);
285-
"
204+
run: cargo fmt -- --check

0 commit comments

Comments
 (0)