-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (60 loc) · 2.45 KB
/
tests.yml
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Test main code base
on:
push:
branches: ["main"]
workflow_call:
secrets:
PASSED_ASYNCORD_TEST_TOKEN:
required: true
description: "Discord bot token for testing"
workflow_dispatch:
permissions:
contents: read
concurrency:
# The workflow run is canceled if a run on the same branch is in progress
group: "${{ github.workflow }} @ ${{ github.ref }}"
cancel-in-progress: true
jobs:
code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
tests:
runs-on: ubuntu-latest
env:
ASYNCORD_TEST_TOKEN: ${{ secrets.PASSED_ASYNCORD_TEST_TOKEN || secrets.ASYNCORD_TEST_TOKEN }}
ASYNCORD_TEST_CHANNEL_ID: ${{ vars.ASYNCORD_TEST_CHANNEL_ID }}
ASYNCORD_TEST_VOICE_CHANNEL_ID: ${{ vars.ASYNCORD_TEST_VOICE_CHANNEL_ID }}
ASYNCORD_TEST_GUILD_ID: ${{ vars.ASYNCORD_TEST_GUILD_ID }}
ASYNCORD_TEST_USER_ID: ${{ vars.ASYNCORD_TEST_USER_ID }}
ASYNCORD_TEST_MESSAGE_ID: ${{ vars.ASYNCORD_TEST_MESSAGE_ID }}
ASYNCORD_TEST_MEMBER_ID: ${{ vars.ASYNCORD_TEST_MEMBER_ID }}
ASYNCORD_TEST_CUSTOM_EMOJI: ${{ vars.ASYNCORD_TEST_CUSTOM_EMOJI }}
ASYNCORD_TEST_GUILD_PREFIX_TO_DELETE: ${{ vars.ASYNCORD_TEST_GUILD_PREFIX_TO_DELETE }}
ASYNCORD_TEST_APP_ID: ${{ vars.ASYNCORD_TEST_APP_ID }}
ASYNCORD_TEST_ROLE_ID: ${{ vars.ASYNCORD_TEST_ROLE_ID }}
ASYNCORD_TEST_USER_TO_BAN: ${{ vars.ASYNCORD_TEST_USER_TO_BAN }}
ASYNCORD_TEST_ROLE_TO_PRUNE: ${{ vars.ASYNCORD_TEST_ROLE_TO_PRUNE }}
ASYNCORD_TEST_WORKERS: ${{ vars.ASYNCORD_TEST_WORKERS }}
strategy:
fail-fast: false
max-parallel: 1
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0 # fetch tags doesn't work without this (https://github.com/actions/checkout/issues/1748)
clean: false
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest tests -n $ASYNCORD_TEST_WORKERS