Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Test datumTableEditor

on:
push:
branches:
- '!main'
pull_request:
branches:
- 'main'

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[dev]"

- name: Run tests
run: python -m pytest tests
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: datumTableEditor Release
Comment thread
Dinesh-Axle marked this conversation as resolved.

on:
push:
branches:
- main

permissions:
contents: write

concurrency:
group: datumTableEditor-release-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
outputs:
release_changed: ${{ steps.release-semantic.outputs.changed }}
release_version: ${{ steps.release-semantic.outputs.version }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Compute semantic version
id: release-semantic
uses: paulhatch/semantic-version@v5.4.0
with:
major_pattern: "breaking"
minor_pattern: "feat"
bump_each_commit_patch_pattern: "fix"
bump_each_commit: true
change_path: "."
version_format: "${major}.${minor}.${patch}"

- name: Inject semantic version into metadata
if: steps.release-semantic.outputs.changed == 'true'
run: |
VERSION=${{ steps.release-semantic.outputs.version }}
sed -i.bak 's/^version = .*/version = "'$VERSION'"/' pyproject.toml
cat pyproject.toml | grep version
Comment thread
Dinesh-Axle marked this conversation as resolved.

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[dev]"

- name: Run tests
run: python -m pytest tests

- name: Build distribution
if: steps.release-semantic.outputs.changed == 'true'
run: |
python -m pip install --upgrade build
python -m build --sdist --wheel
VERSION=${{ steps.release-semantic.outputs.version }}
WHL=$(ls dist/*.whl | head -n1)
TAR=$(ls dist/*.tar.gz | head -n1)
DEST_WHL=dist/datumTableEditor-${VERSION}-py3-none-any.whl
DEST_TAR=dist/datumTableEditor-${VERSION}.tar.gz
if [ -f "$DEST_WHL" ] && [ "$WHL" != "$DEST_WHL" ]; then rm -f "$DEST_WHL"; fi
if [ -f "$DEST_TAR" ] && [ "$TAR" != "$DEST_TAR" ]; then rm -f "$DEST_TAR"; fi
if [ "$WHL" != "$DEST_WHL" ]; then mv "$WHL" "$DEST_WHL"; else echo "wheel already named correctly"; fi
if [ "$TAR" != "$DEST_TAR" ]; then mv "$TAR" "$DEST_TAR"; else echo "tarball already named correctly"; fi

- name: Create GitHub Release
if: steps.release-semantic.outputs.changed == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.release-semantic.outputs.version }}
name: datumTableEditor v${{ steps.release-semantic.outputs.version }}
generate_release_notes: true
files: |
dist/datumTableEditor-${{ steps.release-semantic.outputs.version }}-py3-none-any.whl
dist/datumTableEditor-${{ steps.release-semantic.outputs.version }}.tar.gz
Loading