1+ name : Daily Package Test
2+
3+ on :
4+ schedule :
5+ # Runs at 08:00 UTC every day
6+ - cron : ' 0 8 * * *'
7+ workflow_dispatch : # Allow manual triggering
8+
9+ jobs :
10+ test-install :
11+ runs-on : ${{ matrix.os }}
12+ strategy :
13+ matrix :
14+ os : [ubuntu-latest, windows-latest, macos-latest]
15+ python-version : ['3.10', '3.11', '3.12', '3.13']
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Install uv
21+ uses : astral-sh/setup-uv@v5
22+ with :
23+ enable-cache : true
24+
25+ - name : Set up Python ${{ matrix.python-version }}
26+ run : uv python install ${{ matrix.python-version }}
27+
28+ - name : Test PyPI package installation
29+ shell : bash
30+ run : |
31+ python -m venv test-env
32+ if [[ "$RUNNER_OS" == "Windows" ]]; then
33+ source test-env/Scripts/activate
34+ else
35+ source test-env/bin/activate
36+ fi
37+ pip install safetext
38+ python -c "from safetext import SafeText; st = SafeText('en'); result = st.check_profanity('test shit'); print(f'Profanity detection working: {result}')"
39+
40+ - name : Test development installation
41+ shell : bash
42+ run : |
43+ uv sync --extra dev
44+ if [[ "$RUNNER_OS" == "Windows" ]]; then
45+ source .venv/Scripts/activate
46+ else
47+ source .venv/bin/activate
48+ fi
49+ pytest -v -n auto
50+
51+ - name : Test all language support
52+ shell : bash
53+ run : |
54+ if [[ "$RUNNER_OS" == "Windows" ]]; then
55+ source .venv/Scripts/activate
56+ else
57+ source .venv/bin/activate
58+ fi
59+ cat > test_languages.py << 'EOF'
60+ from safetext import SafeText
61+ languages = ['ar', 'az', 'de', 'en', 'es', 'fa', 'fr', 'hi', 'ja', 'pt', 'ru', 'tr', 'zh']
62+ for lang in languages:
63+ try:
64+ st = SafeText(lang)
65+ print(f'✓ {lang} loaded successfully')
66+ except Exception as e:
67+ print(f'✗ {lang} failed: {e}')
68+ exit(1)
69+ EOF
70+ python test_languages.py
71+
72+ - name : Check for dependency conflicts
73+ shell : bash
74+ run : |
75+ if [[ "$RUNNER_OS" == "Windows" ]]; then
76+ source .venv/Scripts/activate
77+ else
78+ source .venv/bin/activate
79+ fi
80+ pip check
81+
82+ - name : Report status
83+ if : failure()
84+ uses : actions/github-script@v7
85+ with :
86+ script : |
87+ const os = '${{ matrix.os }}';
88+ const python = '${{ matrix.python-version }}';
89+ github.rest.issues.create({
90+ owner: context.repo.owner,
91+ repo: context.repo.repo,
92+ title: `Daily test failed on ${os} Python ${python}`,
93+ body: `The daily package test failed. Please check the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).`,
94+ labels: ['ci-failure', 'automated']
95+ })
0 commit comments