-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (95 loc) · 2.99 KB
/
ci.yml
File metadata and controls
111 lines (95 loc) · 2.99 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
99
100
101
102
103
104
105
106
107
108
109
110
111
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:
fail-fast: false
matrix:
python-version: &python-versions ["3.10", "3.11", "3.12", "3.13", "3.14"]
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: |
if [ "${{ matrix.python-version }}" = "3.10" ]; then
uv sync --locked --all-extras
else
uv sync --locked --all-extras --all-packages
fi
- name: Type check
run: |
if [ "${{ matrix.python-version }}" = "3.10" ]; then
uv run pyright fishjam
else
uv run pyright
fi
test:
runs-on: ubuntu-latest
needs: [lint-and-format]
strategy:
fail-fast: false
max-parallel: 1
matrix:
python-version: *python-versions
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: |
if [ "${{ matrix.python-version }}" = "3.10" ]; then
uv sync --locked --all-extras
else
uv sync --locked --all-extras --all-packages
fi
- name: Initialize InstaTunnel
id: tunnel
run: |
npm install -g instatunnel
nohup instatunnel 5000 > tunnel.log 2>&1 &
TIMEOUT=60
ELAPSED=0
echo "Waiting for InstaTunnel to generate URL..."
while ! grep -qE 'https://[^ ]+\.instatunnel\.my' tunnel.log; do
if [ $ELAPSED -ge $TIMEOUT ]; then
echo "Error: InstaTunnel timed out after ${TIMEOUT}s"
cat tunnel.log
exit 1
fi
sleep 1
ELAPSED=$((ELAPSED + 1))
done
TUNNEL_URL=$(grep -oE 'https://[^ ]+\.instatunnel\.my' tunnel.log | head -n 1)
echo "url=$TUNNEL_URL" >> $GITHUB_OUTPUT
echo "InstaTunnel is live at: $TUNNEL_URL"
- name: Upload InstaTunnel log
if: always()
uses: actions/upload-artifact@v4
with:
name: instatunnel-log-py${{ matrix.python-version }}
path: tunnel.log
- 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 }}