-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (90 loc) · 3.52 KB
/
ci.yml
File metadata and controls
109 lines (90 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Run weekly at 1:23 UTC
schedule:
- cron: '23 1 * * 0'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "test upload via action"
runs-on: ubuntu-latest
if: github.repository == 'scientific-python/upload-nightly-action'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# Don't rely on the action's path being in the current directory
with:
path: '_action_path'
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install the latest version of uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
- name: Build v0.0.1 wheel and sdist
run: |
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Verify the distribution
run: uv tool run twine check --strict dist/*
- name: List contents of sdist
run: python -m tarfile --list dist/test_package-*.tar.gz
- name: List contents of wheel
run: python -m zipfile --list dist/test_package-*.whl
- name: Test upload
uses: ./_action_path/
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }}
- name: Test upload that forces removal first
uses: ./_action_path/
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }}
- name: Build v0.0.2 wheel and sdist
run: |
# Bump version to avoid wheel name conflicts
sed -i 's/0.0.1/0.0.2/g' _action_path/tests/test_package/pyproject.toml
rm ./dist/*
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Test upload with non-main label
uses: ./_action_path/
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }}
anaconda_nightly_upload_labels: test
- name: Build v0.0.3 wheel and sdist
run: |
# Bump version to avoid wheel name conflicts
sed -i 's/0.0.2/0.0.3/g' _action_path/tests/test_package/pyproject.toml
rm ./dist/*
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Test upload with multiple labels
uses: ./_action_path/
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }}
anaconda_nightly_upload_labels: dev,test
cleanup:
runs-on: ubuntu-latest
needs: [test]
# Set required workflow secrets in the environment for additional security
# https://github.com/scientific-python/upload-nightly-action/settings/environments
environment:
name: remove-old-wheels
steps:
- name: Set up pixi
uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
run-install: false
- name: Remove test package upload
shell: pixi exec --spec anaconda-client -- bash -e {0}
run: |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove \
--force \
"scientific-python-nightly-wheels/test-package"