zdm 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zdm-0.6.0/.github/workflows/ci.yml +138 -0
- zdm-0.6.0/.github/workflows/release.yml +337 -0
- zdm-0.6.0/.gitignore +3 -0
- zdm-0.6.0/.pre-commit-config.yaml +25 -0
- zdm-0.6.0/.pre-commit-hooks.yaml +28 -0
- zdm-0.6.0/CHANGELOG.md +197 -0
- zdm-0.6.0/Cargo.lock +1083 -0
- zdm-0.6.0/Cargo.toml +58 -0
- zdm-0.6.0/LICENSE +21 -0
- zdm-0.6.0/PKG-INFO +348 -0
- zdm-0.6.0/README.md +307 -0
- zdm-0.6.0/install.sh +197 -0
- zdm-0.6.0/pyproject.toml +65 -0
- zdm-0.6.0/src/ast/aerich.rs +703 -0
- zdm-0.6.0/src/ast/alembic.rs +944 -0
- zdm-0.6.0/src/ast/extractor.rs +1808 -0
- zdm-0.6.0/src/ast/mod.rs +230 -0
- zdm-0.6.0/src/ast/operations.rs +516 -0
- zdm-0.6.0/src/config/mod.rs +867 -0
- zdm-0.6.0/src/diagnostics/diagnostic.rs +63 -0
- zdm-0.6.0/src/diagnostics/mod.rs +12 -0
- zdm-0.6.0/src/diagnostics/severity.rs +28 -0
- zdm-0.6.0/src/diagnostics/span.rs +86 -0
- zdm-0.6.0/src/discovery.rs +517 -0
- zdm-0.6.0/src/error.rs +266 -0
- zdm-0.6.0/src/file_io.rs +70 -0
- zdm-0.6.0/src/git/mod.rs +1000 -0
- zdm-0.6.0/src/lib.rs +16 -0
- zdm-0.6.0/src/main.rs +891 -0
- zdm-0.6.0/src/parser.rs +697 -0
- zdm-0.6.0/src/rules/help/r002_unique_constraint.txt +16 -0
- zdm-0.6.0/src/rules/help/r006_add_fk.txt +5 -0
- zdm-0.6.0/src/rules/help/r015_alter_field_not_null.txt +7 -0
- zdm-0.6.0/src/rules/help/r017_check_constraint.txt +3 -0
- zdm-0.6.0/src/rules/help/r017_exclusion_constraint.txt +8 -0
- zdm-0.6.0/src/rules/mod.rs +828 -0
- zdm-0.6.0/src/rules/r001_non_concurrent_add_index.rs +309 -0
- zdm-0.6.0/src/rules/r002_unique_constraint_without_index.rs +258 -0
- zdm-0.6.0/src/rules/r003_runsql_create_index.rs +418 -0
- zdm-0.6.0/src/rules/r004_missing_atomic_false.rs +401 -0
- zdm-0.6.0/src/rules/r005_remove_field_without_separate.rs +148 -0
- zdm-0.6.0/src/rules/r006_add_field_foreign_key.rs +324 -0
- zdm-0.6.0/src/rules/r008_disallowed_file_changes.rs +318 -0
- zdm-0.6.0/src/rules/r009_separate_db_state_same_pr.rs +407 -0
- zdm-0.6.0/src/rules/r010_add_field_not_null.rs +275 -0
- zdm-0.6.0/src/rules/r011_rename_field.rs +117 -0
- zdm-0.6.0/src/rules/r012_irreversible_run_python.rs +253 -0
- zdm-0.6.0/src/rules/r013_irreversible_run_sql.rs +154 -0
- zdm-0.6.0/src/rules/r014_model_imports.rs +245 -0
- zdm-0.6.0/src/rules/r015_alter_field_not_null.rs +173 -0
- zdm-0.6.0/src/rules/r016_non_concurrent_remove_index.rs +288 -0
- zdm-0.6.0/src/rules/r017_non_concurrent_add_constraint.rs +379 -0
- zdm-0.6.0/src/rules/test_support.rs +47 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
CARGO_TERM_COLOR: always
|
|
11
|
+
RUST_BACKTRACE: 1
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
name: Test (${{ matrix.os }})
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
26
|
+
with:
|
|
27
|
+
persist-credentials: false
|
|
28
|
+
|
|
29
|
+
- name: Set up Rust
|
|
30
|
+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
|
|
31
|
+
|
|
32
|
+
- name: Cache Cargo
|
|
33
|
+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
|
34
|
+
with:
|
|
35
|
+
path: |
|
|
36
|
+
~/.cargo/bin/
|
|
37
|
+
~/.cargo/registry/index/
|
|
38
|
+
~/.cargo/registry/cache/
|
|
39
|
+
~/.cargo/git/db/
|
|
40
|
+
target/
|
|
41
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
42
|
+
restore-keys: |
|
|
43
|
+
${{ runner.os }}-cargo-
|
|
44
|
+
|
|
45
|
+
- name: Run tests
|
|
46
|
+
run: cargo test --locked --all-features
|
|
47
|
+
|
|
48
|
+
- name: Run tests (release mode)
|
|
49
|
+
run: cargo test --locked --release --all-features
|
|
50
|
+
|
|
51
|
+
lint:
|
|
52
|
+
name: Lint
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
56
|
+
with:
|
|
57
|
+
persist-credentials: false
|
|
58
|
+
|
|
59
|
+
- name: Test installer checksum verification
|
|
60
|
+
run: bash tests/install_checksum.sh
|
|
61
|
+
|
|
62
|
+
- name: Set up Rust
|
|
63
|
+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
|
|
64
|
+
with:
|
|
65
|
+
components: clippy, rustfmt
|
|
66
|
+
|
|
67
|
+
- name: Check formatting
|
|
68
|
+
run: cargo fmt --all -- --check
|
|
69
|
+
|
|
70
|
+
- name: Run Clippy
|
|
71
|
+
run: cargo clippy --locked --all-targets --all-features -- -D warnings
|
|
72
|
+
|
|
73
|
+
security:
|
|
74
|
+
name: Security Audit
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
78
|
+
with:
|
|
79
|
+
persist-credentials: false
|
|
80
|
+
|
|
81
|
+
- name: Install cargo-audit
|
|
82
|
+
run: cargo install cargo-audit --version 0.22.1 --locked
|
|
83
|
+
|
|
84
|
+
- name: Run security audit
|
|
85
|
+
run: cargo audit --deny warnings
|
|
86
|
+
|
|
87
|
+
build:
|
|
88
|
+
name: Build (${{ matrix.target }})
|
|
89
|
+
runs-on: ${{ matrix.os }}
|
|
90
|
+
strategy:
|
|
91
|
+
fail-fast: false
|
|
92
|
+
matrix:
|
|
93
|
+
include:
|
|
94
|
+
# Linux x86_64
|
|
95
|
+
- os: ubuntu-latest
|
|
96
|
+
target: x86_64-unknown-linux-gnu
|
|
97
|
+
# Linux ARM64
|
|
98
|
+
- os: ubuntu-latest
|
|
99
|
+
target: aarch64-unknown-linux-gnu
|
|
100
|
+
# macOS x86_64
|
|
101
|
+
- os: macos-latest
|
|
102
|
+
target: x86_64-apple-darwin
|
|
103
|
+
# macOS ARM64 (Apple Silicon)
|
|
104
|
+
- os: macos-latest
|
|
105
|
+
target: aarch64-apple-darwin
|
|
106
|
+
# Windows x86_64
|
|
107
|
+
- os: windows-latest
|
|
108
|
+
target: x86_64-pc-windows-msvc
|
|
109
|
+
# Windows ARM64
|
|
110
|
+
- os: windows-latest
|
|
111
|
+
target: aarch64-pc-windows-msvc
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
114
|
+
with:
|
|
115
|
+
persist-credentials: false
|
|
116
|
+
|
|
117
|
+
- name: Set up Rust
|
|
118
|
+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
|
|
119
|
+
with:
|
|
120
|
+
targets: ${{ matrix.target }}
|
|
121
|
+
|
|
122
|
+
- name: Install cross-compilation tools (Linux ARM64)
|
|
123
|
+
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
124
|
+
run: |
|
|
125
|
+
sudo apt-get update
|
|
126
|
+
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
127
|
+
|
|
128
|
+
- name: Build
|
|
129
|
+
run: cargo build --locked --release --target ${{ matrix.target }}
|
|
130
|
+
env:
|
|
131
|
+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
132
|
+
|
|
133
|
+
- name: Upload artifact
|
|
134
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
135
|
+
with:
|
|
136
|
+
name: zdm-${{ matrix.target }}
|
|
137
|
+
path: |
|
|
138
|
+
target/${{ matrix.target }}/release/zdm${{ matrix.os == 'windows-latest' && '.exe' || '' }}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
CARGO_TERM_COLOR: always
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
validate-release:
|
|
16
|
+
name: Validate release metadata
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: Check tag is releasable
|
|
25
|
+
run: |
|
|
26
|
+
set -euo pipefail
|
|
27
|
+
git fetch --no-tags origin main
|
|
28
|
+
git merge-base --is-ancestor "$GITHUB_SHA" origin/main
|
|
29
|
+
version="${GITHUB_REF_NAME#v}"
|
|
30
|
+
grep -qx "version = \"$version\"" Cargo.toml
|
|
31
|
+
grep -qx "version = \"$version\"" pyproject.toml
|
|
32
|
+
grep -Eq "^## (\\[$version\\]|$version) - [0-9]{4}-[0-9]{2}-[0-9]{2}$" CHANGELOG.md
|
|
33
|
+
|
|
34
|
+
verify:
|
|
35
|
+
name: Verify release source
|
|
36
|
+
needs: validate-release
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
40
|
+
with:
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
|
|
43
|
+
- name: Set up Rust
|
|
44
|
+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
|
|
45
|
+
with:
|
|
46
|
+
components: clippy, rustfmt
|
|
47
|
+
|
|
48
|
+
- name: Check formatting
|
|
49
|
+
run: cargo fmt --all -- --check
|
|
50
|
+
|
|
51
|
+
- name: Run Clippy
|
|
52
|
+
run: cargo clippy --locked --all-targets --all-features -- -D warnings
|
|
53
|
+
|
|
54
|
+
- name: Install cargo-audit
|
|
55
|
+
run: cargo install cargo-audit --version 0.22.1 --locked
|
|
56
|
+
|
|
57
|
+
- name: Run security audit
|
|
58
|
+
run: cargo audit --deny warnings
|
|
59
|
+
|
|
60
|
+
- name: Run tests
|
|
61
|
+
run: cargo test --locked --all-features
|
|
62
|
+
|
|
63
|
+
- name: Run tests (release mode)
|
|
64
|
+
run: cargo test --locked --release --all-features
|
|
65
|
+
|
|
66
|
+
- name: Check package contents
|
|
67
|
+
run: cargo package --locked --list
|
|
68
|
+
|
|
69
|
+
build-wheels:
|
|
70
|
+
name: Build wheels (${{ matrix.target }})
|
|
71
|
+
needs: verify
|
|
72
|
+
runs-on: ${{ matrix.os }}
|
|
73
|
+
strategy:
|
|
74
|
+
fail-fast: false
|
|
75
|
+
matrix:
|
|
76
|
+
include:
|
|
77
|
+
# Linux x86_64
|
|
78
|
+
- os: ubuntu-latest
|
|
79
|
+
target: x86_64-unknown-linux-gnu
|
|
80
|
+
manylinux: 2_28
|
|
81
|
+
asset: zdm-x86_64-unknown-linux-gnu
|
|
82
|
+
script: zdm
|
|
83
|
+
native: true
|
|
84
|
+
before_script_linux: dnf -y install perl-IPC-Cmd perl-Time-Piece
|
|
85
|
+
# Linux ARM64
|
|
86
|
+
- os: ubuntu-latest
|
|
87
|
+
target: aarch64-unknown-linux-gnu
|
|
88
|
+
manylinux: 2_28
|
|
89
|
+
asset: zdm-aarch64-unknown-linux-gnu
|
|
90
|
+
script: zdm
|
|
91
|
+
native: false
|
|
92
|
+
# macOS x86_64 (Intel)
|
|
93
|
+
- os: macos-15-intel
|
|
94
|
+
target: x86_64-apple-darwin
|
|
95
|
+
asset: zdm-x86_64-apple-darwin
|
|
96
|
+
script: zdm
|
|
97
|
+
native: true
|
|
98
|
+
# macOS ARM64 (Apple Silicon)
|
|
99
|
+
- os: macos-15
|
|
100
|
+
target: aarch64-apple-darwin
|
|
101
|
+
asset: zdm-aarch64-apple-darwin
|
|
102
|
+
script: zdm
|
|
103
|
+
native: true
|
|
104
|
+
# Windows x86_64
|
|
105
|
+
- os: windows-latest
|
|
106
|
+
target: x86_64-pc-windows-msvc
|
|
107
|
+
asset: zdm-x86_64-pc-windows-msvc.exe
|
|
108
|
+
script: zdm.exe
|
|
109
|
+
native: true
|
|
110
|
+
# Windows ARM64
|
|
111
|
+
- os: windows-latest
|
|
112
|
+
target: aarch64-pc-windows-msvc
|
|
113
|
+
asset: zdm-aarch64-pc-windows-msvc.exe
|
|
114
|
+
script: zdm.exe
|
|
115
|
+
native: false
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
118
|
+
with:
|
|
119
|
+
persist-credentials: false
|
|
120
|
+
|
|
121
|
+
- name: Set up Python
|
|
122
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
|
|
123
|
+
with:
|
|
124
|
+
python-version: '3.12'
|
|
125
|
+
|
|
126
|
+
- name: Build wheel
|
|
127
|
+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b
|
|
128
|
+
with:
|
|
129
|
+
command: build
|
|
130
|
+
target: ${{ matrix.target }}
|
|
131
|
+
args: --locked --release --out dist
|
|
132
|
+
manylinux: ${{ matrix.manylinux || '' }}
|
|
133
|
+
before-script-linux: ${{ matrix.before_script_linux || '' }}
|
|
134
|
+
|
|
135
|
+
- name: Extract standalone binary from wheel
|
|
136
|
+
shell: bash
|
|
137
|
+
env:
|
|
138
|
+
ASSET: ${{ matrix.asset }}
|
|
139
|
+
SCRIPT: ${{ matrix.script }}
|
|
140
|
+
run: |
|
|
141
|
+
set -euo pipefail
|
|
142
|
+
python - <<'PY'
|
|
143
|
+
import glob
|
|
144
|
+
import os
|
|
145
|
+
import shutil
|
|
146
|
+
import zipfile
|
|
147
|
+
|
|
148
|
+
wheels = glob.glob("dist/*.whl")
|
|
149
|
+
if len(wheels) != 1:
|
|
150
|
+
raise SystemExit(f"expected one wheel, found {wheels}")
|
|
151
|
+
with zipfile.ZipFile(wheels[0]) as wheel:
|
|
152
|
+
suffix = f".data/scripts/{os.environ['SCRIPT']}"
|
|
153
|
+
scripts = [name for name in wheel.namelist() if name.endswith(suffix)]
|
|
154
|
+
if len(scripts) != 1:
|
|
155
|
+
raise SystemExit(f"expected one {suffix} entry, found {scripts}")
|
|
156
|
+
with wheel.open(scripts[0]) as source, open(os.environ["ASSET"], "wb") as target:
|
|
157
|
+
shutil.copyfileobj(source, target)
|
|
158
|
+
PY
|
|
159
|
+
if [[ "$ASSET" != *.exe ]]; then chmod +x "$ASSET"; fi
|
|
160
|
+
|
|
161
|
+
- name: Smoke test wheel and binary (Unix)
|
|
162
|
+
if: matrix.native && runner.os != 'Windows'
|
|
163
|
+
shell: bash
|
|
164
|
+
run: |
|
|
165
|
+
set -euo pipefail
|
|
166
|
+
python -m venv .venv-wheel
|
|
167
|
+
.venv-wheel/bin/pip install dist/*.whl
|
|
168
|
+
test "$(.venv-wheel/bin/zdm --version)" = "zdm ${GITHUB_REF_NAME#v}"
|
|
169
|
+
test "$(./${{ matrix.asset }} --version)" = "zdm ${GITHUB_REF_NAME#v}"
|
|
170
|
+
set +e
|
|
171
|
+
.venv-wheel/bin/zdm tests/fixtures/rules/R001/fail_non_concurrent_add_index.py --select R001
|
|
172
|
+
status=$?
|
|
173
|
+
set -e
|
|
174
|
+
test "$status" -eq 1
|
|
175
|
+
|
|
176
|
+
- name: Smoke test manylinux baseline
|
|
177
|
+
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
178
|
+
shell: bash
|
|
179
|
+
run: |
|
|
180
|
+
set -euo pipefail
|
|
181
|
+
test "$(docker run --rm -v "$PWD:/io" quay.io/pypa/manylinux_2_28_x86_64 "/io/${{ matrix.asset }}" --version)" = "zdm ${GITHUB_REF_NAME#v}"
|
|
182
|
+
|
|
183
|
+
- name: Smoke test wheel and binary (Windows)
|
|
184
|
+
if: matrix.native && runner.os == 'Windows'
|
|
185
|
+
shell: pwsh
|
|
186
|
+
run: |
|
|
187
|
+
python -m venv .venv-wheel
|
|
188
|
+
$wheel = (Get-ChildItem dist/*.whl).FullName
|
|
189
|
+
& .venv-wheel/Scripts/python -m pip install $wheel
|
|
190
|
+
$version = $env:GITHUB_REF_NAME.Substring(1)
|
|
191
|
+
if ((& .venv-wheel/Scripts/zdm.exe --version).Trim() -ne "zdm $version") {
|
|
192
|
+
throw "installed wheel has the wrong version"
|
|
193
|
+
}
|
|
194
|
+
if ((& ./${{ matrix.asset }} --version).Trim() -ne "zdm $version") {
|
|
195
|
+
throw "standalone binary has the wrong version"
|
|
196
|
+
}
|
|
197
|
+
& .venv-wheel/Scripts/zdm.exe tests/fixtures/rules/R001/fail_non_concurrent_add_index.py --select R001
|
|
198
|
+
$status = $LASTEXITCODE
|
|
199
|
+
if ($status -ne 1) {
|
|
200
|
+
throw "known R001 violation returned $status instead of 1"
|
|
201
|
+
}
|
|
202
|
+
$global:LASTEXITCODE = 0
|
|
203
|
+
|
|
204
|
+
- name: Upload wheel
|
|
205
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
206
|
+
with:
|
|
207
|
+
name: wheel-${{ matrix.target }}
|
|
208
|
+
path: dist/*.whl
|
|
209
|
+
|
|
210
|
+
- name: Upload standalone binary
|
|
211
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
212
|
+
with:
|
|
213
|
+
name: binary-${{ matrix.target }}
|
|
214
|
+
path: ${{ matrix.asset }}
|
|
215
|
+
|
|
216
|
+
build-sdist:
|
|
217
|
+
name: Build source distribution
|
|
218
|
+
needs: verify
|
|
219
|
+
runs-on: ubuntu-latest
|
|
220
|
+
steps:
|
|
221
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
222
|
+
with:
|
|
223
|
+
persist-credentials: false
|
|
224
|
+
|
|
225
|
+
- name: Set up Python
|
|
226
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
|
|
227
|
+
with:
|
|
228
|
+
python-version: '3.12'
|
|
229
|
+
|
|
230
|
+
- name: Set up Rust
|
|
231
|
+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
|
|
232
|
+
|
|
233
|
+
- name: Build sdist
|
|
234
|
+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b
|
|
235
|
+
with:
|
|
236
|
+
command: sdist
|
|
237
|
+
args: --out dist
|
|
238
|
+
|
|
239
|
+
- name: Smoke test source distribution
|
|
240
|
+
shell: bash
|
|
241
|
+
run: |
|
|
242
|
+
set -euo pipefail
|
|
243
|
+
python -m venv .venv-sdist
|
|
244
|
+
.venv-sdist/bin/pip install dist/*.tar.gz
|
|
245
|
+
test "$(.venv-sdist/bin/zdm --version)" = "zdm ${GITHUB_REF_NAME#v}"
|
|
246
|
+
|
|
247
|
+
- name: Upload sdist
|
|
248
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
249
|
+
with:
|
|
250
|
+
name: sdist
|
|
251
|
+
path: dist/*.tar.gz
|
|
252
|
+
|
|
253
|
+
verify-release-artifacts:
|
|
254
|
+
name: Verify release artifacts
|
|
255
|
+
needs: [build-wheels, build-sdist]
|
|
256
|
+
runs-on: ubuntu-latest
|
|
257
|
+
steps:
|
|
258
|
+
- name: Download all artifacts
|
|
259
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
|
260
|
+
with:
|
|
261
|
+
path: artifacts
|
|
262
|
+
|
|
263
|
+
- name: Prepare and verify release assets
|
|
264
|
+
run: |
|
|
265
|
+
set -euo pipefail
|
|
266
|
+
mkdir -p release pypi
|
|
267
|
+
find artifacts -name "*.whl" -exec mv {} release/ \;
|
|
268
|
+
find artifacts -name "*.tar.gz" -exec mv {} release/ \;
|
|
269
|
+
find artifacts -name "zdm-*" -exec mv {} release/ \;
|
|
270
|
+
test "$(find release -maxdepth 1 -name '*.whl' | wc -l)" -eq 6
|
|
271
|
+
test "$(find release -maxdepth 1 -name '*.tar.gz' | wc -l)" -eq 1
|
|
272
|
+
for asset in \
|
|
273
|
+
zdm-x86_64-unknown-linux-gnu \
|
|
274
|
+
zdm-aarch64-unknown-linux-gnu \
|
|
275
|
+
zdm-x86_64-apple-darwin \
|
|
276
|
+
zdm-aarch64-apple-darwin \
|
|
277
|
+
zdm-x86_64-pc-windows-msvc.exe \
|
|
278
|
+
zdm-aarch64-pc-windows-msvc.exe; do
|
|
279
|
+
test -f "release/$asset"
|
|
280
|
+
done
|
|
281
|
+
cp release/*.whl release/*.tar.gz pypi/
|
|
282
|
+
(cd release && sha256sum * > SHA256SUMS)
|
|
283
|
+
ls -la release/ pypi/
|
|
284
|
+
|
|
285
|
+
- name: Upload verified PyPI distributions
|
|
286
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
287
|
+
with:
|
|
288
|
+
name: pypi-distributions
|
|
289
|
+
path: pypi/
|
|
290
|
+
|
|
291
|
+
- name: Upload verified release assets
|
|
292
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
293
|
+
with:
|
|
294
|
+
name: release-assets
|
|
295
|
+
path: release/
|
|
296
|
+
|
|
297
|
+
publish:
|
|
298
|
+
name: Publish to PyPI
|
|
299
|
+
needs: verify-release-artifacts
|
|
300
|
+
runs-on: ubuntu-latest
|
|
301
|
+
environment: pypi
|
|
302
|
+
permissions:
|
|
303
|
+
contents: read
|
|
304
|
+
id-token: write # For trusted publishing
|
|
305
|
+
steps:
|
|
306
|
+
- name: Download verified distributions
|
|
307
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
|
308
|
+
with:
|
|
309
|
+
path: dist
|
|
310
|
+
name: pypi-distributions
|
|
311
|
+
|
|
312
|
+
- name: List artifacts
|
|
313
|
+
run: ls -la dist/
|
|
314
|
+
|
|
315
|
+
- name: Publish to PyPI
|
|
316
|
+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
|
|
317
|
+
with:
|
|
318
|
+
packages-dir: dist/
|
|
319
|
+
|
|
320
|
+
github-release:
|
|
321
|
+
name: Create GitHub Release
|
|
322
|
+
needs: [verify-release-artifacts, publish]
|
|
323
|
+
runs-on: ubuntu-latest
|
|
324
|
+
permissions:
|
|
325
|
+
contents: write
|
|
326
|
+
steps:
|
|
327
|
+
- name: Download verified release assets
|
|
328
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
|
329
|
+
with:
|
|
330
|
+
path: release
|
|
331
|
+
name: release-assets
|
|
332
|
+
|
|
333
|
+
- name: Create Release
|
|
334
|
+
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
|
|
335
|
+
with:
|
|
336
|
+
files: release/*
|
|
337
|
+
generate_release_notes: true
|
zdm-0.6.0/.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Local pre-commit setup for zero-downtime-migrations contributors.
|
|
2
|
+
repos:
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v4.5.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-yaml
|
|
7
|
+
- id: check-added-large-files
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: trailing-whitespace
|
|
11
|
+
|
|
12
|
+
- repo: local
|
|
13
|
+
hooks:
|
|
14
|
+
- id: cargo-fmt
|
|
15
|
+
name: cargo fmt --all
|
|
16
|
+
entry: cargo fmt --all
|
|
17
|
+
language: system
|
|
18
|
+
pass_filenames: false
|
|
19
|
+
types: [rust]
|
|
20
|
+
- id: cargo-clippy
|
|
21
|
+
name: cargo clippy --all-targets --all-features
|
|
22
|
+
entry: cargo clippy --all-targets --all-features -- -D warnings
|
|
23
|
+
language: system
|
|
24
|
+
pass_filenames: false
|
|
25
|
+
types: [rust]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Pre-commit hooks for zero-downtime-migrations
|
|
2
|
+
# See https://pre-commit.com for more information
|
|
3
|
+
|
|
4
|
+
- id: zdm
|
|
5
|
+
name: Zero-Downtime Migrations Linter
|
|
6
|
+
description: Check Django migrations for PostgreSQL safety issues
|
|
7
|
+
entry: zdm
|
|
8
|
+
language: python
|
|
9
|
+
types: [python]
|
|
10
|
+
files: .*/migrations/.*\.py$
|
|
11
|
+
exclude: __init__\.py$
|
|
12
|
+
|
|
13
|
+
- id: zdm-diff
|
|
14
|
+
name: Zero-Downtime Migrations Linter (diff mode)
|
|
15
|
+
description: Check changed Django migrations for PostgreSQL safety issues
|
|
16
|
+
entry: zdm --diff-staged origin/main
|
|
17
|
+
language: python
|
|
18
|
+
pass_filenames: false
|
|
19
|
+
always_run: true
|
|
20
|
+
|
|
21
|
+
- id: zdm-rust
|
|
22
|
+
name: Zero-Downtime Migrations Linter (built from source)
|
|
23
|
+
description: Check Django migrations for PostgreSQL safety issues (auto-builds via cargo install)
|
|
24
|
+
entry: zdm
|
|
25
|
+
language: rust
|
|
26
|
+
types: [python]
|
|
27
|
+
files: .*/migrations/.*\.py$
|
|
28
|
+
exclude: __init__\.py$
|