-
Notifications
You must be signed in to change notification settings - Fork 23
159 lines (138 loc) · 5.33 KB
/
publish.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# workflow to build packages for PyPI
########################################################################################################################################
# This will attempt to retrieve and generate stubs from MicroPython documentation
########################################################################################################################################
# Check out repos in this structure
# micropython-stubs
# +-- stubs
# +-- repos
# +-- micropython
# -- micropython-lib
# repro structure needed to allow automatic PR creation to work
########################################################################################################################################
name: publish-stubs
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'publish/**'
# schedule:
# - cron: "0 1 * * 5" # Run every Friday at 01:00
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
jobs:
########################################################################################################################################
list-versions-pub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# no need to install python
- run: echo Running in folder $(pwd)
- run: pip install pygithub packaging
- run: python .github/workflows/list_versions.py --latest
id: dynamic
outputs:
job_versions: ${{ steps.dynamic.outputs.versions }}
########################################################################################################################################
build-stubs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: list-versions-pub
strategy:
matrix: ${{ fromJSON(needs.list-versions-pub.outputs.job_versions) }}
max-parallel: 1
continue-on-error: true
steps:
- name: Checkout stubs repo
uses: actions/checkout@v3
- name: Install pip and tools to allow to run under ACT for testing
run: |
apt update
# apt upgrade -y
apt install -y python3-pip mc
if: ${{ env.ACT }}
- run: |
pip install wheel
pip install -U micropython-stubber
- run: |
echo Running in folder $(pwd)
stubber --version
stubber clone --no-stubs
- name: Install Poetry
run: pipx install poetry==1.3.1
- run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config --list
# run the build steps for this mpy version
- run: echo "Building stubs for ${{matrix.version}}"
- run: stubber switch ${{matrix.version}}
- run: stubber get-frozen
- run: stubber get-docstubs
- run: stubber merge --version ${{matrix.version}}
- run: |
stubber build --version ${{matrix.version}} --port auto --board GENERIC
stubber build --version ${{matrix.version}} --port esp32 --board UM_TINYPICO
- name: update all_modules.json
run: |
echo "Updating all_modules.json"
# pip install tomli
python3 update_all_modules.py
- name: commit
uses: ./.github/actions/commit
with:
message: "Build stubs for ${{matrix.version}}"
########################################################################################################################################
publish-stubs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: [build-stubs, list-versions-pub]
strategy:
matrix: ${{ fromJSON(needs.list-versions-pub.outputs.job_versions) }}
max-parallel: 1
continue-on-error: true
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_TEST_PYPI }}
steps:
- name: Checkout stubs repo
uses: actions/checkout@v3
- name: Install pip and tools to allow to run under ACT for testing
if: env.ACT
run: |
apt update
# apt upgrade -y
apt install -y python3-pip
python3 -m pip install --user pipx
python3 -m pipx ensurepath
- name: Install Poetry
run: pipx install poetry~=1.3
- run: |
pip install wheel
pip install -U micropython-stubber
- run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config --list
- run: |
stubber clone
stubber switch ${{matrix.version}}
- name: pull in other changes from the repo
run: git pull origin main
- run: |
stubber publish --version ${{matrix.version}} --port auto --board GENERIC --test-pypi
stubber publish --version ${{matrix.version}} --port esp32 --board UM_TINYPICO --test-pypi
if: env.ACT
- run: |
stubber publish --version ${{matrix.version}} --port auto --board GENERIC --pypi
stubber publish --version ${{matrix.version}} --port esp32 --board UM_TINYPICO --pypi
if: env.ACT == ''
- name: update all_modules.json
run: |
echo "Updating all_modules.json"
# pip install tomli
python3 update_all_modules.py
- name: commit
uses: ./.github/actions/commit
with:
message: "Published stubs for ${{matrix.version}}"