-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (85 loc) · 3.09 KB
/
build-test.yml
File metadata and controls
98 lines (85 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# This workflow builds the package, installs it, and tests basic functionality
name: Build and Test Package
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test-build-package:
name: Test package build
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'bump:')"
env:
PYTHON_VERSION: 3.13
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Build the package
run: uv build --python $PYTHON_VERSION
- name: List built artifacts
run: ls -la dist/
- name: Install the built wheel
run: |
uv venv --python $PYTHON_VERSION
# Find the wheel file and install it
WHEEL_FILE=$(ls dist/*.whl | head -1)
echo "Installing wheel: $WHEEL_FILE"
uv pip install "$WHEEL_FILE"
- name: Test --version flag
run: |
# Test that the CLI is available and --version works
uv run lightman-ai --version
should-test-docker-build:
permissions:
contents: read
pull-requests: read
name: Check if should `test_docker_build` run
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'bump:')"
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Check if Dockerfile changed
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: docker-changes
with:
filters: |
docker:
- 'Dockerfile'
- '.dockerignore'
workflow:
- ./.github/actions/docker-build/action.yml
- ./.github/workflows/build-test.yml
outputs:
docker: ${{ steps.docker-changes.outputs.docker }}
workflow: ${{ steps.docker-changes.outputs.workflow }}
test-docker-build:
needs: [should-test-docker-build]
name: Test Docker build
runs-on: ubuntu-latest
if: (needs.should-test-docker-build.outputs.workflow == 'true' || needs.should-test-docker-build.outputs.docker == 'true') && !startsWith(github.event.head_commit.message, 'bump:')
permissions:
contents: read
packages: read
steps:
- name: Check out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Log in to GitHub Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: ./.github/actions/docker-build
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/elementsinteractive/lightman-ai:buildcache