Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add test workflow for action #27

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
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@v3

- name: Set up Python
uses: actions/setup-python@v4
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 a wheel and a sdist
run: |
PYTHONWARNINGS=error,default::DeprecationWarning 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 }}
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So where would this test package end up being uploaded? Is there any cleanup planned once the upload is successful?

Copy link
Member Author

@matthewfeickert matthewfeickert Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So where would this test package end up being uploaded?

https://anaconda.org/scientific-python-nightly-wheels/test-package

(c.f. #27 (comment))

Is there any cleanup planned once the upload is successful?

No, but does there need to be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I would definitely like to avoid polluting the user deployed space with testing artifacts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would definitely like to avoid polluting the user deployed space with testing artifacts.

Can you elaborate as to why this matters? Also please suggest an alternative location.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not suggesting another location, but to do a cleanup. Easy and simple and the pollution will be only present when there is a problem.


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@v1
with:
environment-name: remove-wheels
create-args: >-
python=3.11
anaconda-client

- name: Remove test package upload
shell: bash -l {0}
Copy link
Member Author

@matthewfeickert matthewfeickert Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay final burst of noise (sorry) to add in this shell line so that conda works in Actions. This works as expected (just tested on a debug branch on the main project).

run: |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove \
--force \
"scientific-python-nightly-wheels/test-package"
1 change: 1 addition & 0 deletions tests/test_package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Test README
13 changes: 13 additions & 0 deletions tests/test_package/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "test-package"
version = "0.0.1"
authors = [
{ name="Scientifc Python Developers", email="null@example.com" },
]
description = "Test project for testing GitHub Action"
readme = "README.md"
requires-python = ">=3.8"
Empty file.