Skip to content

Commit

Permalink
Use uv for packaging and update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Nov 7, 2024
1 parent f2bcc9a commit c7d0ab4
Show file tree
Hide file tree
Showing 8 changed files with 2,279 additions and 2,833 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ on:
- '*'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- main

jobs:
docker:
name: Docker

runs-on: ubuntu-latest

env:
USER: sdss
APP: archon

steps:
- name: Set docker tags
id: set-tags
Expand All @@ -26,26 +33,33 @@ jobs:
then
BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's/[\/]/_/g')
echo TAGS=$USER/$APP:$BRANCH >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/pull/* ]]
then
BRANCH=${{ github.head_ref || github.ref_name }}
echo TAGS=$USER/$APP:$BRANCH >> $GITHUB_OUTPUT
else
echo TAGS=$USER/$APP:${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
fi
- name: Show tags
run: echo ${{ steps.set-tags.outputs.TAGS }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Authorise Package Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PAC_TOKEN }}

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
provenance: false
tags: ghcr.io/${{ steps.set-tags.outputs.TAGS }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
10 changes: 3 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ name: Lint

on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '**.md'
- '**.rst'
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
- '**.md'
- '**.rst'

jobs:
lint:
name: Lint

runs-on: ubuntu-latest

steps:
Expand All @@ -24,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: '3.12'
cache: 'pip'

- name: Lint with ruff
Expand Down
35 changes: 15 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ on:
name: Create Release

jobs:
build:
name: Build wheels
runs-on: ubuntu-latest
release:
name: Build and publish

strategy:
matrix:
python-version: ['3.12']
runs-on: ubuntu-latest

permissions:
contents: write
Expand All @@ -23,27 +20,25 @@ jobs:
uses: actions/checkout@v4

- name: Create release
uses: softprops/action-gh-release@v2
uses: taiki-e/create-gh-release-action@v1
with:
title: archon $version
changelog: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
name: archon ${{ github.ref_name }}
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build wheels
run: |
pyproject-build -w
python-version: '3.12'

- name: Build source
- name: Build source and dist
run: |
pyproject-build -s
uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 14 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ name: Test

on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '**.md'
- '**.rst'
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
- '**.md'
- '**.rst'

jobs:
test:
name: Test

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']

env:
OBSERVATORY: 'LCO'

steps:
- uses: actions/checkout@v4
Expand All @@ -30,17 +29,20 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Install dependencies
run: |
pip install --upgrade wheel pip setuptools
pip install .[fitsio]
uv sync --no-dev --frozen
- name: Test with pytest
run: |
pip install pytest pytest-mock pytest-asyncio pytest-cov
pytest
uv pip install pytest pytest-mock pytest-asyncio pytest-cov
uv run pytest
env:
OBSERVATORY: LCO

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Next version

### ⚙️ Engineering

* Migrate to using `uv` for packaging.
* Update workflows.


## 0.14.0 - July 14, 2024

### 🔥 Breaking changes
Expand Down
Loading

0 comments on commit c7d0ab4

Please sign in to comment.