-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build == 1.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file was autogenerated by uv via the following command: | ||
# uv pip compile --python-version 3.12 --python-platform linux lockfile.in | ||
build==1.1.1 | ||
# via -r lockfile.in | ||
packaging==24.0 | ||
# via build | ||
pyproject-hooks==1.1.0 | ||
# via build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
|
||
workflow_dispatch: | ||
|
||
push: | ||
branches: | ||
- trunk | ||
|
||
jobs: | ||
setup_uv_default: | ||
name: setup-uv [default] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: "3.12" | ||
- name: Set up Python environment | ||
uses: ./setup-uv | ||
- run: uv --version | ||
|
||
setup_uv_version: | ||
name: setup-uv [version] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: "3.12" | ||
- name: Set up Python environment | ||
uses: ./setup-uv | ||
with: | ||
version: 0.2.2 | ||
- run: uv --version | ||
|
||
setup_uv_lockfile: | ||
name: setup-uv [lockfile] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: "3.12" | ||
- name: Set up Python environment | ||
uses: ./setup-uv | ||
with: | ||
lockfile: .github/workflows/lockfile.txt | ||
- run: uv --version | ||
- run: python -m build --version | ||
|
||
tests_complete: | ||
name: All tests | ||
if: always() | ||
needs: [setup_uv_default, setup_uv_version, setup_uv_lockfile] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' | ||
- name: Done | ||
run: exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ci: | ||
autoupdate_schedule: quarterly | ||
autoupdate_branch: 'trunk' | ||
autofix_prs: false | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: 'v4.5.0' | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: check-case-conflict | ||
- id: mixed-line-ending | ||
- repo: https://github.com/crate-ci/typos | ||
rev: v1.21.0 | ||
hooks: | ||
- id: typos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Workflows | ||
|
||
`glotzerlab/workflows` houses reusable GitHub actions and workflows that are in common | ||
use across glotzerlab software packages. | ||
|
||
## setup-uv | ||
|
||
`setup-uv` installs [uv] and *optionally* installs all the packages in a given | ||
`lockfile`. | ||
|
||
To generate a lockfile, run: | ||
```bash | ||
uv pip compile --python-version 3.12 --python-platform linux requirements.in > requirements.txt | ||
``` | ||
and add both `requirements.in` and `requirements.txt` to the git repository. | ||
|
||
In your action workflow, create a Python environment and then call setup-uv: | ||
```yaml | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: "3.12" | ||
- name: Set up Python environment | ||
uses: glotzerlab/workflows/setup-python@<insert hash of tagged version here> # v0.1.0 | ||
with: | ||
lockfile: "requirements.txt" | ||
``` | ||
[uv]: https://github.com/astral-sh/uv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Setup uv | ||
description: Install uv and synchronize the environment with a given lock file. | ||
|
||
inputs: | ||
version: | ||
description: 'uv version to install.' | ||
required: false | ||
default: '0.2.6' | ||
lockfile: | ||
description: 'Packages to install.' | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install uv | ||
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ inputs.version }}/uv-installer.sh | bash | ||
shell: bash | ||
|
||
- name: Install | ||
if: ${{ inputs.lockfile != '' }} | ||
run: "uv pip sync ${{ inputs.lockfile }} --only-binary :all: --system --reinstall" | ||
shell: bash |