Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

97 automatically build and push to pypi #426

Merged
merged 9 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
workflow_call:

jobs:
build:
name: Build
build-docs:
name: Build Documentation

runs-on: ubuntu-latest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: Auto Format and Lint
name: Code Quality

on:
pull_request:
push:
branches:
- main
merge_group:

jobs:
autoformat-and-lint:
name: Auto Format and Lint
static-analysis:
name: Static Analysis
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
Expand All @@ -22,27 +21,39 @@ jobs:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_COMMIT }}

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install

- name: 📝 Format Code
run: hatch fmt -f
run: hatch fmt

- name: ✅ Commit code format changes
- name: ✅ Commit Code Format Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Auto format code"
commit_message: "Hatch static analysis"
skip_fetch: true
skip_checkout: true

type-check:
name: Type Check
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_COMMIT }}

- name: 🧶 Lint
run: hatch fmt --check
- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install

- name: 🔍 Type Check
run: hatch run check
run: hatch run check
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release Version

on:
push:
tags:
- "v*"

jobs:
# Publish Python package to PyPI.
publish-to-pypi:
name: Publish to PyPI

runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/ephys-link

permissions:
id-token: write

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install

- name: 🔨 Build Package
run: hatch build

- name: 📦 Publish Distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# Build Windows executable and make release.
build-and-release:
name: Build Executable and Release

runs-on: windows-latest

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install

- name: 🔨 Build Executable
run: hatch run exe

- name: 🤐 Zip Build Folder
# FIXME: Need correct CLI with correct folder name.
run: Compress-Archive -Path dist/ephys-link-${{ github.ref_name }} -Destination dist/ephys-link-${{ github.ref_name }}.zip

- name: 📦 Make Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
# FIXME: Use correct name.
artifacts: "dist/ephys-link-${{ github.ref_name }}.zip,dist/ephys-link-${{ github.ref_name }}.exe"
artifactErrorsFailBuild: true
generateReleaseNotes: true
prerelease: ${{ contains(github.ref_name, "a") || contains(github.ref_name, "b") || contains(github.ref_name, "c") || contains(github.ref_name, "d") }}
Loading