CI #144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set up Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.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" |