Skip to content

Commit 690ca7b

Browse files
Commit SQLX changes from CI directly
1 parent f79e83e commit 690ca7b

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: cargo sqlx migrate run --database-url $DOCSRS_DATABASE_URL
5353

5454
- name: run sqlx prepare --check
55-
run: just sqlx-check
55+
run: just sqlx
5656

5757
- name: test reverse migrations
5858
run: |
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
on:
2+
pull_request_target:
3+
branches:
4+
- master
5+
types: [closed]
6+
7+
env:
8+
RUST_BACKTRACE: 1
9+
RUST_CACHE_KEY: rust-cache-20241114
10+
DOCSRS_PREFIX: ignored/cratesfyi-prefix
11+
DOCSRS_DATABASE_URL: postgresql://cratesfyi:password@localhost:15432
12+
DOCSRS_LOG: docs_rs=debug,rustwide=info
13+
AWS_ACCESS_KEY_ID: cratesfyi
14+
AWS_SECRET_ACCESS_KEY: secret_key
15+
S3_ENDPOINT: http://localhost:9000
16+
DOCSRS_INCLUDE_DEFAULT_TARGETS: false
17+
DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
18+
SENTRY_ENVIRONMENT: dev
19+
20+
permissions:
21+
contents: write
22+
23+
jobs:
24+
update-labels:
25+
if: ${{ github.event.pull_request.merged }}
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: install `just`
31+
run: sudo snap install --edge --classic just
32+
33+
- name: restore build & cargo cache
34+
uses: Swatinem/rust-cache@v2
35+
with:
36+
prefix-key: ${{ env.RUST_CACHE_KEY }}
37+
38+
- name: install SQLX CLI
39+
run: cargo install sqlx-cli --no-default-features --features postgres
40+
41+
- name: run database migrations
42+
run: cargo sqlx migrate run --database-url $DOCSRS_DATABASE_URL
43+
44+
- name: Commit sqlx changes on master branch if any
45+
run: |
46+
cp .env.sample .env
47+
mkdir -p ${DOCSRS_PREFIX}/public-html
48+
docker compose up -d db s3
49+
# Give the database enough time to start up
50+
sleep 5
51+
# Make sure the database is actually working
52+
psql "${DOCSRS_DATABASE_URL}"
53+
54+
just sqlx-prepare
55+
# If there are differences in the SQLX files, then we push them on the master branch
56+
if git status --porcelain .sqlx ; then
57+
git config --global user.name 'Docs.rs developers'
58+
git config --global user.email '[email protected]'
59+
git add .sqlx
60+
git commit -m 'Update SQLX files'
61+
git push
62+
fi
63+
64+
- name: Clean up the database
65+
run: docker compose down --volumes

.github/workflows/tag-merged-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
pull_request_target:
3-
branches:
3+
branches:
44
- master
55
types: [closed]
66

0 commit comments

Comments
 (0)