gh-action-pypi-publish/.github/workflows/self-smoke-test-action.yml

100 lines
2.7 KiB
YAML
Raw Normal View History

---
2022-12-07 05:06:05 +08:00
name: 🧪
2022-12-06 06:01:24 +08:00
on: # yamllint disable-line rule:truthy
2022-12-06 06:33:07 +08:00
push:
pull_request:
2022-12-06 06:01:24 +08:00
env:
devpi-password: abcd1234
devpi-username: root
devpi-port: 3141
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
MYPY_FORCE_COLOR: 1 # MyPy's color enforcement
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_NO_WARN_SCRIPT_LOCATION: 1
PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
TOX_PARALLEL_NO_SPINNER: 1
TOX_TESTENV_PASSENV: >- # Make tox-wrapped tools see color requests
FORCE_COLOR
MYPY_FORCE_COLOR
NO_COLOR
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE
2022-12-06 06:01:24 +08:00
jobs:
2022-12-07 05:06:28 +08:00
smoke-test:
2022-12-06 06:01:24 +08:00
runs-on: ubuntu-latest
2022-12-06 06:01:24 +08:00
services:
devpi:
image: muccg/devpi
env:
DEVPI_PASSWORD: ${{ env.devpi-password }}
2022-12-06 06:01:24 +08:00
ports:
- 3141
timeout-minutes: 2
2022-12-06 06:01:24 +08:00
steps:
- name: Check out the action locally
uses: actions/checkout@v3
with:
path: test
2024-07-10 22:58:19 +08:00
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
2022-12-07 05:26:08 +08:00
- name: Install the packaging-related tools
2024-07-10 22:44:22 +08:00
run: python3 -m pip install -r test/requirements/test.txt
2022-12-07 05:26:08 +08:00
- name: Create the stub package importable directory
run: mkdir -pv src/test_package
2022-12-07 05:26:08 +08:00
- name: Populate the stub package `__init__.py`
run: echo '__version__ = "0.1"' > src/test_package/__init__.py
- name: Populate the stub package `README.md`
run: echo "# Test Package" > README.md
- name: Populate the stub package `pyproject.toml`
run: echo "$CONTENTS" > pyproject.toml
env:
CONTENTS: |
[build-system]
requires = [
"setuptools == 70.3.0",
]
build-backend = "setuptools.build_meta"
[project]
name = "test-package"
version = "0.1"
readme = "README.md"
2022-12-07 05:26:08 +08:00
- name: Build the stub package sdist and wheel distributions
run: python3 -m build
- name: Register the stub package in devpi
run: twine register dist/*.tar.gz
env:
TWINE_USERNAME: ${{ env.devpi-username }}
TWINE_PASSWORD: ${{ env.devpi-password }}
TWINE_REPOSITORY_URL: >-
http://localhost:${{
job.services.devpi.ports[env.devpi-port]
}}/${{
env.devpi-username
}}/public/
2022-12-07 05:26:08 +08:00
- name: ✅ Smoke-test the locally checked out action
uses: ./test
env:
DEBUG: >-
true
PATH: utter-nonsense
with:
user: ${{ env.devpi-username }}
password: ${{ env.devpi-password }}
repository-url: >-
http://devpi:${{ env.devpi-port }}/${{ env.devpi-username }}/public/
...