Skip to content

Merge pull request #95 from unum-cloud/main-dev #40

Merge pull request #95 from unum-cloud/main-dev

Merge pull request #95 from unum-cloud/main-dev #40

Workflow file for this run

name: Release
on:
push:
branches: ["main"]
env:
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
versioning:
name: Update Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/[email protected]
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
package.json:"version": "(\d+\.\d+\.\d+)"
package-lock.json:"uform",\n\s+"version": "(\d+\.\d+\.\d+)"
CITATION.cff:^version: (\d+\.\d+\.\d+)
pyproject.toml:^version = "(\d+\.\d+\.\d+)"
dry-run: "false"
push: "true"
create-release: "true"
github-token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
rebase:
name: Rebase Dev. Branch
needs: versioning
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Perform rebase
run: |
git fetch origin main
git checkout main-dev
git rebase origin/main
- name: Push changes
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
branch: main-dev
unprotect_reviews: True
force: True
test_python:
name: Run Tests
runs-on: ubuntu-latest
needs: versioning
steps:
- uses: actions/checkout@v4
with:
ref: "main"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[onnx]"
pip install pytest
- name: Run PyTest
run: pytest python/scripts/
publish_python:
name: Publish Python
runs-on: ubuntu-latest
needs: [versioning, test_python]
steps:
- uses: actions/checkout@v4
with:
ref: "main"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
publish_javascript:
name: Publish JavaScript
needs: versioning
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: "main"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# TODO: JavaScript tests pass, but ONNX throws a memory error on exit
# - name: Build and Test
# run: |
# npm ci
# npm test
- name: Publish
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
deploy_docs:
name: Deploy Docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: [publish_python, publish_javascript]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"
- name: Install dependencies
run: |
sudo apt update &&
sudo apt install -y doxygen graphviz dia git &&
pip install sphinx==5.3.0 sphinx-js==3.2.1 breathe==4.35.0 furo==2023.3.27 m2r2==0.3.3.post2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery==4.1 &&
npm install -g jsdoc
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Install UForm from PyPi
run: pip install uform
- name: Build documentation
run: cd docs && make html
- name: Copy assets
run: cp -r assets build/docs/html/
- name: Upload artifacts
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: "./build/docs/html/"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1