authswap 1.0.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.
- authswap-1.0.0/.github/workflows/rust-pypi-wheels.yml +209 -0
- authswap-1.0.0/.gitignore +12 -0
- authswap-1.0.0/Cargo.lock +3130 -0
- authswap-1.0.0/Cargo.toml +31 -0
- authswap-1.0.0/LICENSE +21 -0
- authswap-1.0.0/PKG-INFO +173 -0
- authswap-1.0.0/README.md +153 -0
- authswap-1.0.0/demo/cockpit_demo +12 -0
- authswap-1.0.0/demo/cpa_demo +10 -0
- authswap-1.0.0/demo/sub2api_demo +15 -0
- authswap-1.0.0/pyproject.toml +29 -0
- authswap-1.0.0/src/main.rs +4018 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
name: Build and publish wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
- "*.*.*"
|
|
8
|
+
pull_request:
|
|
9
|
+
paths:
|
|
10
|
+
- "Cargo.toml"
|
|
11
|
+
- "Cargo.lock"
|
|
12
|
+
- "pyproject.toml"
|
|
13
|
+
- "src/**"
|
|
14
|
+
- ".github/workflows/rust-pypi-wheels.yml"
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
test:
|
|
22
|
+
name: Test Rust CLI
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
27
|
+
with:
|
|
28
|
+
components: rustfmt, clippy
|
|
29
|
+
- run: cargo fmt --check
|
|
30
|
+
- run: cargo clippy --all-targets -- -D warnings
|
|
31
|
+
- run: cargo test
|
|
32
|
+
|
|
33
|
+
build-wheels:
|
|
34
|
+
name: Build wheel (${{ matrix.platform.name }})
|
|
35
|
+
needs: test
|
|
36
|
+
runs-on: ${{ matrix.platform.os }}
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
platform:
|
|
41
|
+
- name: linux-x86_64
|
|
42
|
+
os: ubuntu-latest
|
|
43
|
+
target: x86_64
|
|
44
|
+
manylinux: auto
|
|
45
|
+
cflags_aarch64: ""
|
|
46
|
+
- name: linux-i686
|
|
47
|
+
os: ubuntu-latest
|
|
48
|
+
target: i686
|
|
49
|
+
manylinux: auto
|
|
50
|
+
cflags_aarch64: ""
|
|
51
|
+
- name: linux-aarch64
|
|
52
|
+
os: ubuntu-latest
|
|
53
|
+
target: aarch64
|
|
54
|
+
manylinux: auto
|
|
55
|
+
cflags_aarch64: "-D__ARM_ARCH=8"
|
|
56
|
+
- name: linux-armv7
|
|
57
|
+
os: ubuntu-latest
|
|
58
|
+
target: armv7
|
|
59
|
+
manylinux: auto
|
|
60
|
+
cflags_aarch64: ""
|
|
61
|
+
- name: macos-aarch64
|
|
62
|
+
os: macos-14
|
|
63
|
+
target: aarch64
|
|
64
|
+
manylinux: auto
|
|
65
|
+
cflags_aarch64: ""
|
|
66
|
+
- name: windows-x86_64
|
|
67
|
+
os: windows-latest
|
|
68
|
+
target: x64
|
|
69
|
+
manylinux: auto
|
|
70
|
+
cflags_aarch64: ""
|
|
71
|
+
- name: windows-i686
|
|
72
|
+
os: windows-latest
|
|
73
|
+
target: x86
|
|
74
|
+
manylinux: auto
|
|
75
|
+
cflags_aarch64: ""
|
|
76
|
+
- name: windows-aarch64
|
|
77
|
+
os: windows-latest
|
|
78
|
+
target: aarch64
|
|
79
|
+
manylinux: auto
|
|
80
|
+
cflags_aarch64: ""
|
|
81
|
+
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v4
|
|
84
|
+
- uses: PyO3/maturin-action@v1
|
|
85
|
+
env:
|
|
86
|
+
AUTHSWAP_WEBDAV_URL: ""
|
|
87
|
+
AUTHSWAP_WEBDAV_USERNAME: ""
|
|
88
|
+
AUTHSWAP_WEBDAV_PASSWORD: ""
|
|
89
|
+
AUTHSWAP_WEBDAV_TOKEN: ""
|
|
90
|
+
AUTHSWAP_CODEX_USAGE_URL: ""
|
|
91
|
+
CODEX_HOME: ""
|
|
92
|
+
HTTP_PROXY: ""
|
|
93
|
+
HTTPS_PROXY: ""
|
|
94
|
+
ALL_PROXY: ""
|
|
95
|
+
CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.platform.cflags_aarch64 }}
|
|
96
|
+
with:
|
|
97
|
+
target: ${{ matrix.platform.target }}
|
|
98
|
+
args: --release --out dist --find-interpreter
|
|
99
|
+
sccache: true
|
|
100
|
+
manylinux: ${{ matrix.platform.manylinux }}
|
|
101
|
+
- uses: actions/upload-artifact@v4
|
|
102
|
+
with:
|
|
103
|
+
name: wheels-${{ matrix.platform.name }}
|
|
104
|
+
path: dist/*.whl
|
|
105
|
+
if-no-files-found: error
|
|
106
|
+
|
|
107
|
+
build-sdist:
|
|
108
|
+
name: Build sdist
|
|
109
|
+
needs: test
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
steps:
|
|
112
|
+
- uses: actions/checkout@v4
|
|
113
|
+
- uses: PyO3/maturin-action@v1
|
|
114
|
+
env:
|
|
115
|
+
AUTHSWAP_WEBDAV_URL: ""
|
|
116
|
+
AUTHSWAP_WEBDAV_USERNAME: ""
|
|
117
|
+
AUTHSWAP_WEBDAV_PASSWORD: ""
|
|
118
|
+
AUTHSWAP_WEBDAV_TOKEN: ""
|
|
119
|
+
AUTHSWAP_CODEX_USAGE_URL: ""
|
|
120
|
+
CODEX_HOME: ""
|
|
121
|
+
HTTP_PROXY: ""
|
|
122
|
+
HTTPS_PROXY: ""
|
|
123
|
+
ALL_PROXY: ""
|
|
124
|
+
with:
|
|
125
|
+
command: sdist
|
|
126
|
+
args: --out dist
|
|
127
|
+
- uses: actions/upload-artifact@v4
|
|
128
|
+
with:
|
|
129
|
+
name: sdist
|
|
130
|
+
path: dist/*.tar.gz
|
|
131
|
+
if-no-files-found: error
|
|
132
|
+
|
|
133
|
+
verify-artifacts:
|
|
134
|
+
name: Verify release artifacts
|
|
135
|
+
needs:
|
|
136
|
+
- build-wheels
|
|
137
|
+
- build-sdist
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/download-artifact@v4
|
|
141
|
+
with:
|
|
142
|
+
pattern: wheels-*
|
|
143
|
+
path: dist
|
|
144
|
+
merge-multiple: true
|
|
145
|
+
- uses: actions/download-artifact@v4
|
|
146
|
+
with:
|
|
147
|
+
name: sdist
|
|
148
|
+
path: dist
|
|
149
|
+
- name: Reject packaged local config files
|
|
150
|
+
shell: bash
|
|
151
|
+
run: |
|
|
152
|
+
python3 <<'PY'
|
|
153
|
+
import re
|
|
154
|
+
import tarfile
|
|
155
|
+
import zipfile
|
|
156
|
+
from pathlib import Path
|
|
157
|
+
|
|
158
|
+
forbidden = re.compile(
|
|
159
|
+
r"(^|/)(\.codex|\.env|auth\.json|authswap\.json|config\.toml|registry\.json)$"
|
|
160
|
+
r"|(^|/)[^/]+\.auth\.json$"
|
|
161
|
+
r"|(^|/)(accounts|proxy|webdav)(/|$)",
|
|
162
|
+
re.IGNORECASE,
|
|
163
|
+
)
|
|
164
|
+
artifacts = sorted(Path("dist").glob("*"))
|
|
165
|
+
if not artifacts:
|
|
166
|
+
raise SystemExit("no artifacts found")
|
|
167
|
+
offenders = []
|
|
168
|
+
for artifact in artifacts:
|
|
169
|
+
names = []
|
|
170
|
+
if artifact.suffix == ".whl":
|
|
171
|
+
with zipfile.ZipFile(artifact) as archive:
|
|
172
|
+
names = archive.namelist()
|
|
173
|
+
elif artifact.name.endswith(".tar.gz"):
|
|
174
|
+
with tarfile.open(artifact, "r:gz") as archive:
|
|
175
|
+
names = archive.getnames()
|
|
176
|
+
for name in names:
|
|
177
|
+
normalized = name.replace("\\", "/")
|
|
178
|
+
if forbidden.search(normalized):
|
|
179
|
+
offenders.append(f"{artifact}: {name}")
|
|
180
|
+
if offenders:
|
|
181
|
+
raise SystemExit(
|
|
182
|
+
"release artifacts contain local config-like files:\n"
|
|
183
|
+
+ "\n".join(offenders)
|
|
184
|
+
)
|
|
185
|
+
PY
|
|
186
|
+
|
|
187
|
+
publish:
|
|
188
|
+
name: Publish to PyPI
|
|
189
|
+
if: github.ref_type == 'tag'
|
|
190
|
+
needs:
|
|
191
|
+
- verify-artifacts
|
|
192
|
+
runs-on: ubuntu-latest
|
|
193
|
+
environment:
|
|
194
|
+
name: pypi
|
|
195
|
+
url: https://pypi.org/project/authswap/
|
|
196
|
+
permissions:
|
|
197
|
+
contents: read
|
|
198
|
+
id-token: write
|
|
199
|
+
steps:
|
|
200
|
+
- uses: actions/download-artifact@v4
|
|
201
|
+
with:
|
|
202
|
+
pattern: wheels-*
|
|
203
|
+
path: dist
|
|
204
|
+
merge-multiple: true
|
|
205
|
+
- uses: actions/download-artifact@v4
|
|
206
|
+
with:
|
|
207
|
+
name: sdist
|
|
208
|
+
path: dist
|
|
209
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|