-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Regression testing is expanded (#54) * Added a github action to build and install * Test on more python versions * Test the devel branch * Added a missing requirement to fix tests * Test on Windows and MacOS too * Auto-detect python version and require at least Python 3.9 (#55) * Fix conda runtime on Windows (operating from within conda as well) (#56) * Added basic locking (#58) * Fixed README after the modules are split in two (#57) * Auto-deply to pypi (#61) * Create SECURITY.md
- Loading branch information
Showing
28 changed files
with
431 additions
and
126 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
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
name: CD on Linux, MacOS and Windows | ||
|
||
on: | ||
push: | ||
branches: ["main", "devel"] | ||
pull_request: | ||
branches: ["main", "devel"] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
runs-on: ${{ matrix.os }} | ||
if: "!startsWith(github.event.head_commit.message, 'Version updated')" | ||
env: | ||
BIN_DIR: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.*') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Prepare environments | ||
run: | | ||
python -m pip install --upgrade pip build | ||
mkdir .venv | ||
python -m venv .venv/build | ||
(. .venv/build/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
python -m venv .venv/build-cli | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
python -m venv .venv/install | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
- name: Test building and packaging | ||
run: | | ||
(. .venv/build/${{ env.BIN_DIR }}/activate && cd partcad && python -m build && cd .. && deactivate) | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate) | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate) | ||
cp README.md partcad-cli | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && cd partcad-cli && python -m build && cd .. && deactivate) | ||
- name: Test installation | ||
run: | | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad-cli/requirements.txt && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad-cli/dist partcad-cli && deactivate) |
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,137 @@ | ||
name: Deployment to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- "**" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
# Keep the "build" job identical to "python-build.yml". | ||
# TODO(clairbee): include "python-build.yml" instead | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.11"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
BIN_DIR: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.*') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Prepare environments | ||
run: | | ||
python -m pip install --upgrade pip build | ||
mkdir .venv | ||
python -m venv .venv/build | ||
(. .venv/build/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
python -m venv .venv/build-cli | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
python -m venv .venv/install | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate) | ||
- name: Test building and packaging | ||
run: | | ||
(. .venv/build/${{ env.BIN_DIR }}/activate && cd partcad && python -m build && cd .. && deactivate) | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate) | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate) | ||
cp README.md partcad-cli | ||
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && cd partcad-cli && python -m build && cd .. && deactivate) | ||
- name: Test installation | ||
run: | | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad-cli/requirements.txt && deactivate) | ||
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad-cli/dist partcad-cli && deactivate) | ||
# Upload artifact from the selected OS/Python version combination only | ||
- name: Upload "partcad" | ||
if: | ||
"startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' | ||
&& matrix.python-version == '3.11'" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: partcad/dist/ | ||
- name: Upload "partcad-cli" | ||
if: | ||
"startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' | ||
&& matrix.python-version == '3.11'" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: partcad-cli/dist/ | ||
|
||
publish-to-pypi: | ||
name: Publish to PyPI | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
|
||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11" | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist | ||
|
||
- name: Clone the repo | ||
run: | | ||
git clone https://github.com/openvmp/partcad | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
cd partcad; | ||
if ( git branch -a --contains ${{ github.ref_name }} | grep -q -e "^ remotes/origin/devel" -e "^ remotes/origin/main" ); then | ||
gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""; | ||
fi | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
cd partcad; | ||
if ( git branch -a --contains ${{ github.ref_name }} | grep -q -e "^ remotes/origin/devel" -e "^ remotes/origin/main" ); then | ||
cd ..; | ||
gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'; | ||
cd partcad; | ||
fi | ||
if ( git branch -a --contains ${{ github.ref_name }} | grep -q "^ remotes/origin/main" ); then | ||
echo "DEPLOY_TO_TEST=FALSE" >> $GITHUB_ENV; | ||
else | ||
echo "DEPLOY_TO_TEST=TRUE" >> $GITHUB_ENV; | ||
fi | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: | ||
"${{ env.DEPLOY_TO_TEST=='FALSE' && 'https://pypi.org/legacy/' || | ||
'https://test.pypi.org/legacy/' }}" | ||
user: __token__ | ||
password: | ||
"${{ env.DEPLOY_TO_TEST=='FALSE' && secrets.PYPI_KEY || | ||
secrets.TEST_PYPI_KEY }}" |
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,53 @@ | ||
name: CI on Linux, MacOS and Windows | ||
|
||
on: | ||
push: | ||
branches: ["main", "devel"] | ||
pull_request: | ||
branches: ["main", "devel"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
exclude: | ||
- os: "windows-latest" | ||
python-version: "3.11" | ||
runs-on: ${{ matrix.os }} | ||
if: "!startsWith(github.event.head_commit.message, 'Version updated')" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.*') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
miniconda-version: latest | ||
activate-environment: pc-conda-env | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U pytest | ||
pip install -r partcad/requirements.txt | ||
# pip install -r partcad-cli/requirements.txt | ||
- name: Test with pytest | ||
env: | ||
PYTHONPATH: partcad/src | ||
PYTHONWARNINGS: ignore | ||
run: | | ||
pytest -x -p no:error-for-skips |
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.conda | ||
.venv | ||
*.egg-info | ||
__pycache__ | ||
.pytest_cache | ||
|
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
Oops, something went wrong.