-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"' |