feat: add skills #35
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Pipeline | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| - 'Dockerfile' | |
| - 'docker/**' | |
| - 'res/phonics/unicode_mapping_table/overwrite.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_pattern_one.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_pattern_two.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_exceptional_pattern.txt' | |
| pull_request: | |
| branches: [ master ] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| - 'Dockerfile' | |
| - 'docker/**' | |
| - 'res/phonics/unicode_mapping_table/overwrite.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_pattern_one.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_pattern_two.txt' | |
| - 'res/phonics/duo_yin_zi/phrase_of_exceptional_pattern.txt' | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| COMPOSE_DOCKER_CLI_BUILD: 1 | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install project with development dependencies | |
| pip install -e ".[dev]" | |
| # Install additional CI-specific tools | |
| pip install safety | |
| - name: Run security checks | |
| run: | | |
| # Security vulnerability scan using bandit.yaml config | |
| bandit -r src/ -f json -o bandit-report.json -c bandit.yaml || echo "Security issues found" | |
| # Dependency security check | |
| safety check --output json > safety-report.json || echo "Dependency vulnerabilities found" | |
| - name: Run unit tests with coverage | |
| run: | | |
| PYTHONPATH=src pytest tests/unit/ --cov=src --cov-report=xml --cov-report=html -v | |
| - name: Run security tests | |
| run: | | |
| PYTHONPATH=src pytest tests/security/ -v | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| docker-build: | |
| name: Docker Build Test | |
| runs-on: ubuntu-latest | |
| needs: test | |
| strategy: | |
| matrix: | |
| font-style: [han_serif, handwritten] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| cd docker | |
| docker compose build mengshen-font | |
| - name: Verify Docker image | |
| run: | | |
| cd docker | |
| docker compose run --rm mengshen-font otfccdump --version | |
| docker compose run --rm mengshen-font python --version | |
| - name: Test template JSON generation | |
| run: | | |
| cd docker | |
| docker compose run --rm -v $(pwd)/../outputs:/app/outputs -v $(pwd)/../tmp:/app/tmp mengshen-font \ | |
| bash -c " | |
| set -e | |
| echo 'Testing template JSON generation for ${{ matrix.font-style }}' | |
| PYTHONPATH=src python -m refactored.scripts.make_template_jsons --style ${{ matrix.font-style }} | |
| ls -la /app/tmp/json/ | |
| " | |
| - name: Test Latin alphabet extraction | |
| run: | | |
| cd docker | |
| docker compose run --rm -v $(pwd)/../outputs:/app/outputs -v $(pwd)/../tmp:/app/tmp mengshen-font \ | |
| bash -c " | |
| set -e | |
| echo 'Testing Latin alphabet extraction for ${{ matrix.font-style }}' | |
| PYTHONPATH=src python -m refactored.scripts.retrieve_latin_alphabet --style ${{ matrix.font-style }} | |
| ls -la /app/tmp/json/ | |
| " | |
| - name: Test pattern table generation | |
| run: | | |
| cd docker | |
| docker compose run --rm -v $(pwd)/../outputs:/app/outputs -v $(pwd)/../res:/app/res mengshen-font \ | |
| bash -c " | |
| set -e | |
| echo 'Testing pattern table generation' | |
| cd res/phonics/duo_yin_zi/scripts && python make_pattern_table.py | |
| cd ../../unicode_mapping_table && python make_unicode_pinyin_map_table.py | |
| ls -la /app/outputs/ | |
| " | |
| - name: Test dry-run font generation | |
| run: | | |
| cd docker | |
| docker compose run --rm -v $(pwd)/../outputs:/app/outputs -v $(pwd)/../tmp:/app/tmp mengshen-font \ | |
| bash -c " | |
| set -e | |
| echo 'Testing dry-run font generation for ${{ matrix.font-style }}' | |
| PYTHONPATH=src python -m refactored.cli.main -t ${{ matrix.font-style }} --dry-run --verbose | |
| " | |
| performance-test: | |
| name: Performance Benchmark | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install project with development dependencies | |
| pip install -e ".[dev]" | |
| - name: Run performance benchmarks | |
| run: | | |
| PYTHONPATH=src pytest tests/performance/ --benchmark-only --benchmark-json=benchmark.json -v | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: benchmark.json |