Skip to content

Profiler, run-history timeline, secrets, webhook + email triggers, embedder fixes #84

Profiler, run-history timeline, secrets, webhook + email triggers, embedder fixes

Profiler, run-history timeline, secrets, webhook + email triggers, embedder fixes #84

Workflow file for this run

name: AutoControl Stable CI
on:
push:
branches: [ "main", "stable" ]
pull_request:
branches: [ "main", "stable" ]
schedule:
- cron: "0 1 * * *"
permissions:
contents: read
concurrency:
group: stable-publish-${{ github.ref }}
cancel-in-progress: false
jobs:
test:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r dev_requirements.txt
pip install -e .
# Screen tests
- name: Test Screen Size
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
- name: Test Screen Get Pixel
run: python ./test/unit_test/screen/get_pixel_test.py
- name: Upload Screenshot Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshot_png_${{ matrix.python-version }}
path: test.png
if-no-files-found: ignore
# Keyboard tests
- name: Test Keyboard Type
run: python ./test/unit_test/keyboard/keyboard_type_test.py
- name: Test Keyboard Write
run: python ./test/unit_test/keyboard/keyboard_write_test.py
- name: Test Keyboard Is Press
run: python ./test/unit_test/keyboard/keyboard_is_press_test.py
- name: Test Keyboard Hotkey
run: python ./test/unit_test/keyboard/hotkey_test.py
# Mouse tests
- name: Test Mouse Module
run: python ./test/unit_test/mouse/mouse_test.py
continue-on-error: true
# Exception tests
- name: Test Exceptions
run: python ./test/unit_test/exception/auto_control_exception_test.py
# Critical exit tests
- name: Test Critical Exit
run: python ./test/unit_test/critical_exit/critical_exit_test.py
continue-on-error: true
- name: Test Real Critical Situation
run: python ./test/unit_test/critical_exit/real_critical_test.py
continue-on-error: true
# Record tests
- name: Test Record Module
run: python ./test/unit_test/record/record_test.py
- name: Test Total Record
run: python ./test/unit_test/total_record/total_record_test.py
# Executor tests
- name: Test Execute Action
run: python ./test/unit_test/execute_action/execute_action_test.py
# JSON tests
- name: Test JSON Module
run: python ./test/unit_test/json/json_test.py
# Report generation tests
- name: Test Generate JSON Report
run: python ./test/unit_test/generate_report/json_report.py
- name: Test Generate HTML Report
run: python ./test/unit_test/generate_report/html_report_test.py
# Argparse test
- name: Test Argparse
run: python ./test/unit_test/argparse/argparse_test.py
# Callback test
- name: Test Callback Module
run: python ./test/unit_test/callback/callback_test.py
# Project creation test
- name: Test Create Project
run: python ./test/unit_test/create_project_file/create_project_test.py
# Info tests
- name: Test Get Mouse Info
run: python ./test/unit_test/get_info/mouse_info.py
- name: Test Get Keyboard Info
run: python ./test/unit_test/get_info/keyboard_info.py
publish:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Bump patch version in pyproject.toml
id: bump
run: |
python <<'PY'
import os
import re
import pathlib
path = pathlib.Path("pyproject.toml")
text = path.read_text(encoding="utf-8")
match = re.search(r'^version\s*=\s*"(\d+)\.(\d+)\.(\d+)"', text, flags=re.M)
if not match:
raise SystemExit("version line not found in pyproject.toml")
major, minor, patch = (int(part) for part in match.groups())
new_version = f"{major}.{minor}.{patch + 1}"
text = re.sub(
r'^version\s*=\s*"\d+\.\d+\.\d+"',
f'version = "{new_version}"',
text,
count=1,
flags=re.M,
)
path.write_text(text, encoding="utf-8")
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as fh:
fh.write(f"new_version={new_version}\n")
print(f"Bumped to {new_version}")
PY
- name: Build distribution
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --non-interactive dist/*
- name: Commit and push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add pyproject.toml
git commit -m "Bump version to ${{ steps.bump.outputs.new_version }} [skip ci]"
git tag "v${{ steps.bump.outputs.new_version }}"
git pull --rebase origin main
git push origin main
git push origin "v${{ steps.bump.outputs.new_version }}"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.bump.outputs.new_version }}" \
dist/* \
--title "v${{ steps.bump.outputs.new_version }}" \
--generate-notes