Modernize #37
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: Python CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'python/**' | |
| - '.github/workflows/python-arabic.yml' | |
| pull_request: | |
| paths: | |
| - 'python/**' | |
| - '.github/workflows/python-arabic.yml' | |
| # Cancel in-progress runs for the same workflow and branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| dependency-review: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Dependency Review | |
| uses: actions/dependency-review-action@v3 | |
| codeql: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v2 | |
| with: | |
| languages: python | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v2 | |
| infer: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| python/arabic/requirements.txt | |
| python/arabic/setup.py | |
| - name: Install requirements | |
| working-directory: ./python/arabic | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade --upgrade-strategy eager -r requirements.txt -e . | |
| - name: Create model directory | |
| working-directory: ./python/arabic | |
| run: | | |
| mkdir -p log_dir/CA_MSA.base.cbhg/models/ | |
| - name: Download PyTorch model | |
| working-directory: ./python/arabic | |
| run: | | |
| curl -sSL https://github.com/secryst/rababa-models/releases/download/0.1/2000000-snapshot.pt \ | |
| -o log_dir/CA_MSA.base.cbhg/models/2000000-snapshot.pt | |
| - name: Run diacriticization | |
| working-directory: ./python/arabic | |
| run: | | |
| python diacritize.py --model_kind "cbhg" --config config/cbhg.yml --text 'قطر' | |
| train: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| python/arabic/requirements.txt | |
| python/arabic/setup.py | |
| - name: Install requirements | |
| working-directory: ./python/arabic | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade --upgrade-strategy eager -r requirements.txt -e . | |
| - name: Prepare dataset | |
| working-directory: ./python/arabic | |
| run: | | |
| mkdir -p data/CA_MSA | |
| touch data/CA_MSA/{eval,train,test}.csv | |
| cd data | |
| curl -sSL https://github.com/interscript/rababa-tashkeela/archive/refs/tags/v1.0.zip -o tashkeela.zip | |
| unzip tashkeela.zip | |
| for d in `ls rababa-tashkeela-1.0/tashkeela_val/*`; do cat $d >> CA_MSA/eval.csv; done | |
| for d in `ls rababa-tashkeela-1.0/tashkeela_train/*`; do cat $d >> CA_MSA/train.csv; done | |
| for d in `ls rababa-tashkeela-1.0/tashkeela_test/*`; do cat $d >> CA_MSA/test.csv; done | |
| - name: Try training (WIP) | |
| working-directory: ./python/arabic | |
| run: | | |
| python train.py --model "cbhg" --config config/test_cbhg.yml | |
| security-scan: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install safety | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install safety | |
| - name: Check for vulnerabilities in Arabic requirements | |
| working-directory: ./python/arabic | |
| run: | | |
| safety check -r requirements.txt --full-report || true | |
| - name: Check for vulnerabilities in Hebrew requirements | |
| working-directory: ./python/hebrew | |
| run: | | |
| safety check -r requirements.txt --full-report || true |