-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 3.05 KB
/
pypi_test.yaml
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
name: "GREEN: Test PyPI Upload Job"
# export tt=pypi-g
# git tag -d "$tt"; git push --delete origin "$tt"; git tag "$tt" && git push origin "$tt"
on:
workflow_dispatch:
push:
branches:
- "test"
tags:
- "all"
- "pypi"
- "pypi-g"
jobs:
build_python:
runs-on: ubuntu-latest
name: Build Python
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Tooling
run: |
pip install --upgrade pip
pip install tox==3.28
# Emulate Build Python
- name: Build Python in './dist/' folder
run: tox -e build
# Emulate Artifacts Upload
- run: echo ARTIFACTS=unit_test_artifacts >> $GITHUB_OUTPUT
id: set_artifacts_ref
- name: Artifacts Upload of .tar.gz and .whl files
uses: actions/upload-artifact@v3
with:
name: ${{ steps.set_artifacts_ref.outputs.ARTIFACTS }}
path: dist
outputs:
ARTIFACTS: ${{ steps.set_artifacts_ref.outputs.ARTIFACTS }}
call_pypi:
name: Password from Repo Secrets
needs: build_python
uses: boromir674/automated-workflows/.github/workflows/pypi.yml@test
with:
distro_name: cicd_test_workflow
distro_version: "0.0.1"
should_trigger: true
artifacts_path: ${{ needs.build_python.outputs.ARTIFACTS }}
pypi_server: "testpypi"
TWINE_USERNAME: "__token__"
secrets:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_testpypi_from_repo_secrets }}
call_pypi1:
name: Creds from Repo Environment
needs: build_python
uses: boromir674/automated-workflows/.github/workflows/pypi_env.yml@test
with:
distro_name: cicd_test_workflow
distro_version: "0.0.1"
should_trigger: true
pypi_env: "PYPI_TEST"
artifacts_path: ${{ needs.build_python.outputs.ARTIFACTS }}
require_wheel: true
allow_existing: true
secrets:
# This magically works, and the environment secret will be loaded
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
# it is really weird to pass a secret here because it feels that is comming from outside,
# from the repository secrets, not from the environment. But it doesn't!
call_pypi3:
name: 'EXPECT GREEN since allow_existing is True by default'
needs: build_python
uses: boromir674/automated-workflows/.github/workflows/pypi_env.yml@test
with:
distro_name: cicd_test_workflow
distro_version: "0.0.1"
should_trigger: true
pypi_env: "PYPI_TEST"
artifacts_path: ${{ needs.build_python.outputs.ARTIFACTS }}
require_wheel: true
secrets:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
# verify_python_distro_uploaded:
# runs-on: ubuntu-latest
# needs: call_pypi_env
# if: always()
# steps:
# - name: Assert UPLOADED to '${{ inputs.pypi_server }}' PyPI
# run: |
# TEST_PYPI='https://test.pypi.org/simple/'
# pip install --dry-run --no-deps --index-url "${TEST_PYPI}" "${{ inputs.distro_name }}"