name: CI on: push: pull_request: workflow_dispatch: jobs: ci: runs-on: self-hosted env: DISCORD_TOKEN: "0" OPENAI_TOKEN: "0" steps: - uses: actions/checkout@v6 - name: Install dependencies run: uv sync --all-extras --dev -U - name: Lint the Python code using ruff run: ruff check --exit-non-zero-on-fix --verbose - name: Check formatting run: ruff format --check --verbose - name: Run tests run: uv run pytest # NOTE: The runner must be allowed to run these commands without a password. # sudo EDITOR=nvim visudo # forgejo-runner ALL=(lovinator) NOPASSWD: /usr/bin/git -C /home/lovinator/ANewDawn pull # forgejo-runner ALL=(root) NOPASSWD: /bin/systemctl restart anewdawn.service # forgejo-runner ALL=(lovinator) NOPASSWD: /usr/bin/uv sync -U --all-extras --dev --directory /home/lovinator/ANewDawn - name: Deploy & restart bot (master only) if: ${{ success() && github.ref == 'refs/heads/master' }} run: | # Keep checkout in the Forgejo runner workspace, whatever that is. # actions/checkout already checks out to the runner's working directory. sudo -u lovinator git -C /home/lovinator/ANewDawn pull sudo -u lovinator uv sync -U --all-extras --dev --directory /home/lovinator/ANewDawn sudo systemctl restart anewdawn.service