-
Notifications
You must be signed in to change notification settings - Fork 75
96 lines (91 loc) · 2.57 KB
/
python-ci.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
name: Python CI
on:
push:
branches: [main, ci-*]
paths:
- 'packages/mystmd-py/**'
pull_request:
branches: [main]
paths:
- 'packages/mystmd-py/**'
workflow_dispatch:
jobs:
build-package:
name: Build Python package
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: recursive
- uses: ./.github/actions/install
with:
node: ${{ matrix.node }}
- name: Copy necessary files
run: |
cp packages/mystmd/dist/myst.cjs packages/mystmd-py/src/mystmd_py/
cp packages/mystmd/package.json packages/mystmd-py/_package.json
- name: Build Python package
run: pipx run hatch -- build
working-directory: packages/mystmd-py
- uses: actions/upload-artifact@v4
with:
name: package
path: packages/mystmd-py/dist/mystmd*.whl
if-no-files-found: error
platform-node:
name: Test with Node.js
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: package
- name: Install myst from package
run: pip install mystmd*.whl
- name: Run myst expect success
env:
MYSTMD_ALLOW_NODEENV: 0
run: myst -v
no-node:
name: Test without Node.js
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: package
- name: Run myst and expect failure
uses: "docker://python:3.12.7-slim-bookworm"
with:
entrypoint: /bin/bash
args: '-c "export MYSTMD_ALLOW_NODEENV=0; pip install mystmd*.whl && ! myst -v"'
nodeenv-node:
name: Test with nodeenv
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: package
- name: Run myst with nodeenv and expect success
uses: "docker://python:3.12.7-slim-bookworm"
with:
entrypoint: /bin/bash
args: '-c "export MYSTMD_ALLOW_NODEENV=1; pip install mystmd*.whl && myst -v"'