Skip to content

Update deployment workflow to use 'uv run' #43

Update deployment workflow to use 'uv run'

Update deployment workflow to use 'uv run' #43

Workflow file for this run

# 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