-
Notifications
You must be signed in to change notification settings - Fork 10
112 lines (93 loc) · 3.29 KB
/
ci.yml
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
110
111
112
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.x'
- name: Install python-build and twine
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m pip list
- name: Build v0.0.1 wheel and sdist
run: |
python -m build --outdir ./dist tests/test_package
- name: Verify the distribution
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: ./
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }}
- name: Test upload that forces removal first
uses: ./
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' tests/test_package/pyproject.toml
rm ./dist/*
python -m build --outdir ./dist tests/test_package
- name: Test upload with non-main label
uses: ./
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' tests/test_package/pyproject.toml
rm ./dist/*
python -m build --outdir ./dist tests/test_package
- name: Test upload with multiple labels
uses: ./
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: Install micromamba and anaconda-client
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1.9.0
with:
environment-name: remove-wheels
create-args: >-
python=3.12
anaconda-client
- name: Remove test package upload
shell: bash -l {0}
run: |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove \
--force \
"scientific-python-nightly-wheels/test-package"