Skip to content

Commit

Permalink
Merge pull request #387 from jmmshn/patch_1
Browse files Browse the repository at this point in the history
Versioning update
  • Loading branch information
jmmshn authored May 16, 2024
2 parents e444bba + 3b57f95 commit 4eb3ad7
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 38 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: pytest
name: Testing

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches: [main]
branches:
- main

jobs:
build:
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/pytest-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Tests
name: Build Docs

on: [release, workflow_dispatch]
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main

jobs:
build:
Expand All @@ -20,18 +28,20 @@ jobs:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
- name: Install webdriver
run: sudo apt-get update && sudo apt-get install firefox-geckodriver
run: sudo apt-get update && sudo apt-get install chromium-chromedriver
- name: Install dependencies
run: |
python${{ matrix.python-version }} -m pip install --upgrade pip packaging wheel
python${{ matrix.python-version }} -m pip install `grep numpy== requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt`
python${{ matrix.python-version }} -m pip install -r requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
python${{ matrix.python-version }} -m pip install --upgrade pip
python${{ matrix.python-version }} -m pip install --no-deps .
- name: Build new docs
run: |
cd docs_rst
make html
- name: Detect changes
if: contains(github.ref, 'refs/heads/main')
id: changes
shell: bash
run: |
Expand All @@ -45,7 +55,3 @@ jobs:
git add -A
git commit -m "Automated doc build"
git push
- name: pytest
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: pytest --color=yes --webdriver Firefox --headless crystal_toolkit/apps/examples/tests/
36 changes: 8 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Release

on: workflow_dispatch
on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
Expand All @@ -21,32 +26,6 @@ jobs:
cache: "pip"
cache-dependency-path: '**/pyproject.toml'

- name: bump version and create tag
env:
DATE_FORMAT: "%Y.%m.%d"
run: |
NEXT_RELEASE=$(date "+${DATE_FORMAT}")
LAST_RELEASE=$(git tag --sort=v:refname | grep "^20[^\-]*$" | tail -n 1)
echo "Last release : ${LAST_RELEASE}"
MAJOR_LAST_RELEASE=$(echo "${LAST_RELEASE}" | awk -v l=${#NEXT_RELEASE} '{ string=substr($0, 1, l); print string; }')
echo "Last major release : ${MAJOR_LAST_RELEASE}"
if [ "${MAJOR_LAST_RELEASE}" = "${NEXT_RELEASE}" ]; then
MINOR_LAST_RELEASE="$(echo "${LAST_RELEASE}" | awk -v l=$((${#NEXT_RELEASE} + 2)) '{ string=substr($0, l); print string; }')"
NEXT_RELEASE=${MAJOR_LAST_RELEASE}.$((MINOR_LAST_RELEASE + 1))
fi
echo "Next release: ${NEXT_RELEASE}"
git config --local user.email "github-actions@github.com"
git config --local user.name "github-actions"
python -m pip install --upgrade pip
python -m pip install --user --upgrade pip build setuptools "setuptools_scm<8" wheel
SETUPTOOLS_SCM_PRETEND_VERSION=${NEXT_RELEASE} python -m setuptools_scm
git add crystal_toolkit/_version.py
git commit -m "version bump: ${NEXT_RELEASE}"
git push
git tag ${NEXT_RELEASE}
git push --tags
echo "NEXT_RELEASE=${NEXT_RELEASE}" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -56,9 +35,10 @@ jobs:
python -m pip install --no-deps .[server]
- name: Build package
run: SETUPTOOLS_SCM_PRETEND_VERSION=${{env.NEXT_RELEASE}} python -m build
run: pip install build

- name: Publish package
if: contains(github.ref, 'refs/heads/main')
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
user: __token__
Expand Down
1 change: 0 additions & 1 deletion crystal_toolkit/_version.py

This file was deleted.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ ignore-words-list = "nd,te,ois"

[tool.mypy]
no_implicit_optional = false

[tool.versioningit.vcs]
default-tag = "0.0.1"
method = "git"

0 comments on commit 4eb3ad7

Please sign in to comment.