-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (69 loc) · 2.22 KB
/
ci.yml
File metadata and controls
84 lines (69 loc) · 2.22 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
name: CI
on: [push]
jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install project dependencies
run: uv sync --locked --all-extras --all-packages
- name: Format Check
run: uv run format_check
- name: Lint
run: uv run lint
type-check:
runs-on: ubuntu-latest
strategy: &strategy
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install project dependencies
run: uv sync --locked --all-extras --all-packages
- name: Type check
run: uv run pyright
test:
runs-on: ubuntu-latest
needs: [lint-and-format]
strategy: *strategy
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install project dependencies
run: uv sync --locked --all-extras --all-packages
- name: Initialize Localtunnel
id: tunnel
run: |
npx localtunnel --port 5000 > tunnel.log 2>&1 &
# Poll for the URL
TIMEOUT=10
ELAPSED=0
echo "Waiting for localtunnel to generate URL..."
while ! grep -q "https://" tunnel.log; do
if [ $ELAPSED -ge $TIMEOUT ]; then
echo "Error: Localtunnel timed out after ${TIMEOUT}s"
cat tunnel.log
exit 1
fi
sleep 1
ELAPSED=$((ELAPSED + 1))
done
TUNNEL_URL=$(grep -o 'https://[^ ]*' tunnel.log | head -n 1)
echo "url=$TUNNEL_URL" >> $GITHUB_OUTPUT
echo "Localtunnel is live at: $TUNNEL_URL"
- name: Run tests
run: uv run pytest
env:
WEBHOOK_SERVER_URL: ${{ steps.tunnel.outputs.url }}
FISHJAM_ID: ${{ secrets.CI_FISHJAM_ID }}
FISHJAM_MANAGEMENT_TOKEN: ${{ secrets.CI_FISHJAM_MANAGEMENT_TOKEN }}