Skip to content

Commit 6569a98

Browse files
committed
introduce workflow caches
1 parent ff6fe9b commit 6569a98

File tree

3 files changed

+103
-23
lines changed

3 files changed

+103
-23
lines changed

.github/workflows/build.yml

Lines changed: 101 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,33 @@ jobs:
2929
- uses: actions/checkout@v2
3030

3131
- name: setup python ${{ matrix.python-version }} environment
32+
id: setup-python
3233
uses: actions/setup-python@v2
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536

36-
- uses: Gr1N/setup-poetry@v7
37+
- name: install Poetry
38+
uses: snok/install-poetry@v1
39+
with:
40+
virtualenvs-create: true
41+
virtualenvs-in-project: true
42+
installer-parallel: true
3743

3844
- run: pip install poetry-dynamic-versioning
3945

40-
- run: poetry install
46+
- name: Load cached venv
47+
id: cached-poetry-dependencies
48+
uses: actions/cache@v2
49+
with:
50+
path: .venv
51+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
52+
53+
- name: Install dependencies
54+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
55+
run: poetry install --no-interaction --no-root
56+
57+
- name: install robotcode
58+
run: poetry install --no-interaction
4159

4260
- name: "test python packages"
4361
timeout-minutes: 15
@@ -76,15 +94,33 @@ jobs:
7694
- uses: actions/checkout@v1
7795

7896
- name: setup python environment
97+
id: setup-python
7998
uses: actions/setup-python@v2
8099
with:
81100
python-version: "3.8"
82101

83-
- uses: Gr1N/setup-poetry@v7
102+
- name: install Poetry
103+
uses: snok/install-poetry@v1
104+
with:
105+
virtualenvs-create: true
106+
virtualenvs-in-project: true
107+
installer-parallel: true
84108

85109
- run: pip install poetry-dynamic-versioning
86110

87-
- run: poetry install
111+
- name: Load cached venv
112+
id: cached-poetry-dependencies
113+
uses: actions/cache@v2
114+
with:
115+
path: .venv
116+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
117+
118+
- name: Install dependencies
119+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
120+
run: poetry install --no-interaction --no-root
121+
122+
- name: install robotcode
123+
run: poetry install --no-interaction
88124

89125
- run: poetry run isort --check --diff .
90126
if: always()
@@ -110,27 +146,49 @@ jobs:
110146

111147
- run: git describe --tag
112148

113-
- name: Setup Node.js environment
114-
uses: actions/setup-node@v2
115-
with:
116-
node-version: "16"
117-
- uses: actions/setup-python@v2
149+
- name: setup python environment
150+
id: setup-python
151+
uses: actions/setup-python@v2
118152
with:
119153
python-version: "3.8"
120154

121-
- uses: Gr1N/setup-poetry@v7
155+
- name: install Poetry
156+
uses: snok/install-poetry@v1
157+
with:
158+
virtualenvs-create: true
159+
virtualenvs-in-project: true
160+
installer-parallel: true
122161

123162
- run: pip install poetry-dynamic-versioning
124163

125-
- run: poetry install
164+
- name: Load cached venv
165+
id: cached-poetry-dependencies
166+
uses: actions/cache@v2
167+
with:
168+
path: .venv
169+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
170+
171+
- name: Install dependencies
172+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
173+
run: poetry install --no-interaction --no-root
174+
175+
- name: install robotcode
176+
run: poetry install --no-interaction
126177

127178
- run: poetry-dynamic-versioning
128179

180+
- name: Setup Node.js environment
181+
uses: actions/setup-node@v2
182+
with:
183+
node-version: "16"
184+
cache: 'npm'
185+
cache-dependency-path: package-lock.json
186+
129187
- name: install node modules
130188
run: npm install --also=dev
131189

132190
- name: package
133-
run: poetry run npm run package
191+
run: poetry run npm-run package
134192

135193
- name: Upload VSCode package
136194
uses: actions/upload-artifact@v2
@@ -161,22 +219,44 @@ jobs:
161219

162220
- run: git describe --tag
163221

164-
- name: Setup Node.js environment
165-
uses: actions/setup-node@v2
166-
with:
167-
node-version: "16"
168-
- uses: actions/setup-python@v2
222+
- name: setup python environment
223+
id: setup-python
224+
uses: actions/setup-python@v2
169225
with:
170226
python-version: "3.8"
171227

172-
- uses: Gr1N/setup-poetry@v7
228+
- name: install Poetry
229+
uses: snok/install-poetry@v1
230+
with:
231+
virtualenvs-create: true
232+
virtualenvs-in-project: true
233+
installer-parallel: true
173234

174235
- run: pip install poetry-dynamic-versioning
175236

176-
- run: poetry install
237+
- name: Load cached venv
238+
id: cached-poetry-dependencies
239+
uses: actions/cache@v2
240+
with:
241+
path: .venv
242+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
243+
244+
- name: Install dependencies
245+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
246+
run: poetry install --no-interaction --no-root
247+
248+
- name: install robotcode
249+
run: poetry install --no-interaction
177250

178251
- run: poetry-dynamic-versioning
179252

253+
- name: Setup Node.js environment
254+
uses: actions/setup-node@v2
255+
with:
256+
node-version: "16"
257+
cache: 'npm'
258+
cache-dependency-path: package-lock.json
259+
180260
- name: install node modules
181261
run: npm install --also=dev
182262

@@ -195,7 +275,7 @@ jobs:
195275

196276
- name: get release notes
197277
id: get_release_notes
198-
run: echo "::set-output name=release_notes::$(poetry run npm run extract-release-notes)"
278+
run: echo "::set-output name=release_notes::$(poetry run npm-run extract-release-notes)"
199279

200280
- name: find assets
201281
id: find_assets
@@ -255,7 +335,7 @@ jobs:
255335
asset_content_type: application/whl
256336

257337
- name: publish vsix and python packages
258-
run: poetry run npm run publish
338+
run: poetry run npm-run publish
259339
env:
260340
VSCE_PAT: ${{ secrets.VSCE_PAT }}
261341
OVSX_PAT: ${{ secrets.OVSX_PAT }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ classifiers = [
4949
]
5050

5151
[tool.poetry.scripts]
52-
npm='scripts.npm:main'
52+
npm-run='scripts.npm_run:main'
5353

5454
[tool.poetry.dependencies]
5555
python = "^3.8"

scripts/npm.py renamed to scripts/npm_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
def main() -> int:
6-
args = f"npm {' '.join(sys.argv[1:])}"
6+
args = f"npm run {' '.join(sys.argv[1:])}"
77
return run(args, shell=True).returncode
88

99

0 commit comments

Comments
 (0)