Improved readme #6
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: PICA Continuous Integration | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| schedule: | |
| - cron: '30 1 * * 0' | |
| jobs: | |
| test-and-analyze: | |
| name: Test, Analyze & Build Paper | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| language: [ 'python' ] | |
| steps: | |
| # ------------------------------------------------------------------------ | |
| # PHASE 1: SETUP | |
| # ------------------------------------------------------------------------ | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Cache pip dependencies | |
| id: cache-pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install System Dependencies (Tkinter/XVFB) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-tk xvfb | |
| - name: Install Python and Project Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest flake8 pytest-cov | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| pip install -e . | |
| # ------------------------------------------------------------------------ | |
| # PHASE 2: LINT & STYLE CHECKS | |
| # ------------------------------------------------------------------------ | |
| - name: Run Style & Syntax Check (Flake8) | |
| run: | | |
| echo "STEP 1: Checking for critical syntax errors..." | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| echo "STEP 2: Checking for code style warnings..." | |
| flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics | |
| # ------------------------------------------------------------------------ | |
| # PHASE 3: SECURITY SCAN (CodeQL) | |
| # ------------------------------------------------------------------------ | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 # v3 is still supported, v4 is the latest | |
| with: | |
| languages: ${{ matrix.language }} | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 # v3 is still supported, v4 is the latest | |
| with: | |
| category: "/language:${{ matrix.language }}" | |
| # ------------------------------------------------------------------------ | |
| # PHASE 4: AUTOMATED TESTING & COVERAGE | |
| # ------------------------------------------------------------------------ | |
| - name: Run All Tests and Generate Reports | |
| run: | | |
| echo "Running tests with coverage within a virtual display..." | |
| xvfb-run --auto-servernum pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/ | |
| - name: Upload Coverage Report to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: true | |
| # ------------------------------------------------------------------------ | |
| # PHASE 5: BUILD JOSS PAPER DRAFT | |
| # ------------------------------------------------------------------------ | |
| - name: Build JOSS Paper Draft PDF | |
| uses: openjournals/openjournals-draft-action@master | |
| with: | |
| journal: joss | |
| paper-path: paper/paper.md | |
| - name: Upload JOSS Paper Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: paper | |
| path: paper/paper.pdf |