Skip to content

Commit 6cb6720

Browse files
author
spencer@primus
committed
Initial commit
1 parent 8814a15 commit 6cb6720

5 files changed

Lines changed: 149 additions & 0 deletions

File tree

.github/actions/init-uv/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Init python and UV
2+
description: Installs python and UV
3+
4+
inputs:
5+
python-version:
6+
description: Version of python to use
7+
required: true
8+
default: "3.10"
9+
uv-version:
10+
description: Version of UV to install
11+
required: true
12+
default: "0.6.14"
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Set up Python ${{ inputs.python-version }}
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ inputs.python-version }}
21+
22+
- name: Install uv ${{ inputs.uv-version }}
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
version: ${{ inputs.uv-version }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Install with UV
2+
description: Installs uv and the environment as an action
3+
4+
inputs:
5+
python-version:
6+
description: Version of python to use
7+
required: true
8+
default: "3.10"
9+
uv-version:
10+
description: Version of uv to install
11+
required: true
12+
default: "0.6.14"
13+
install-percep:
14+
description: Whether to install perception dependencies
15+
type: boolean
16+
required: true
17+
default: false
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
27+
# Initialize the environment and cache
28+
- name: Init python and uv
29+
uses: avstack-lab/workflows/.github/actions/init-uv@main
30+
with:
31+
python-version: ${{ inputs.python-version }}
32+
uv-version: ${{ inputs.uv-version }}
33+
34+
- name: Set up cache
35+
uses: actions/cache@v3
36+
id: cache
37+
with:
38+
path: .venv
39+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/uv.lock') }}
40+
41+
- name: Ensure cache is healthy
42+
if: steps.cache.outputs.cache-hit == 'true'
43+
shell: bash
44+
run: uv run pip --version >/dev/null 2>&1 || rm -rf .venv
45+
46+
# Install dependences without or with perception extras
47+
- name: Install bare dependencies
48+
shell: bash
49+
if: ${{ ! github.event.inputs.install-percep }}
50+
run: |
51+
uv sync
52+
- name: Install dependencies with perception extras
53+
shell: bash
54+
if: ${{ github.event.inputs.install-percep }}
55+
run: |
56+
uv sync --extra percep

.github/actions/test-uv/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test with UV
2+
description: Run unit tests for this repository
3+
4+
inputs:
5+
test-folder:
6+
description: Location of the folder to test
7+
required: false
8+
default: tests
9+
10+
runs:
11+
using: composite
12+
steps:
13+
# - name: Lint with flake8
14+
# run: |
15+
# # stop the build if there are Python syntax errors or undefined names
16+
# uv run flake8 ./avstack --count --max-line-length=127 --show-source --statistics
17+
- name: Run tests
18+
shell: bash
19+
run: |
20+
uv run pytest ${{ inputs.test-folder }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Run tests on some branch
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
required: true
8+
type: string
9+
os:
10+
default: ubuntu-22.04
11+
type: string
12+
python-versions:
13+
required: false
14+
type: string
15+
default: "[ '3.10' ]"
16+
uv-versions:
17+
required: false
18+
type: string
19+
default: "[ '0.6.14' ]"
20+
21+
jobs:
22+
build_and_test:
23+
name: Run unit tests on ${{ inputs.branch }} branch
24+
25+
runs-on: ${{ inputs.os }}
26+
27+
strategy:
28+
matrix:
29+
python-version: ${{ fromJSON(inputs.python-versions) }}
30+
uv-version: ${{ fromJSON(inputs.uv-versions) }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install environment
36+
uses: avstack-lab/workflows/.github/actions/install-uv@main
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
uv-version: ${{ matrix.uv-version }}
40+
install-percep: true
41+
42+
- name: Run unit tests
43+
uses: avstack-lab/workflows/.github/actions/test-uv@main
44+
with:
45+
test-folder: tests

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Workflows and Actions
2+
3+
Collection of reusable workflows and actions for AVstack.

0 commit comments

Comments
 (0)