feat: update new cookiecutter template #96
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "3.13" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| installer-parallel: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install --no-interaction --no-ansi | |
| - name: Cache Graphviz installation | |
| id: cache-graphviz | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: ~/graphviz-cache | |
| key: graphviz-installed-${{ runner.os }}-v3 | |
| - name: Install Graphviz and Debug | |
| run: | | |
| # ---- DEBUG - REMOVE AFTER FIXING ---- | |
| echo "=== CACHE STATUS ===" | |
| echo "Graphviz Cache hit: ${{ steps.cache-graphviz.outputs.cache-hit }}" | |
| echo "\n=== BEFORE INSTALL ===" | |
| which dot && echo "dot already exists" || echo "dot not found" | |
| if [ "${{ steps.cache-graphviz.outputs.cache-hit }}" = "true" ]; then | |
| echo "\n=== RESTORING CACHED GRAPHVIZ ===" | |
| sudo cp -r ~/graphviz-cache/bin/* /usr/bin/ 2>/dev/null || echo "No binaries to restore" | |
| sudo cp -r ~/graphviz-cache/lib/* /usr/lib/ 2>/dev/null || echo "No libraries to restore" | |
| sudo cp -r ~/graphviz-cache/share/* /usr/share/ 2>/dev/null || echo "No shared files to restore" | |
| sudo ldconfig | |
| else | |
| echo "\n=== INSTALLING GRAPHVIZ ===" | |
| sudo apt-get update | |
| sudo apt-get install -y graphviz | |
| echo "\n=== CACHING GRAPHVIZ ===" | |
| mkdir -p ~/graphviz-cache/{bin,lib,share} | |
| cp /usr/bin/dot /usr/bin/neato /usr/bin/twopi /usr/bin/circo /usr/bin/fdp /usr/bin/sfdp /usr/bin/patchwork /usr/bin/osage ~/graphviz-cache/bin/ 2>/dev/null || echo "Some binaries not found" | |
| cp -r /usr/lib/x86_64-linux-gnu/*graphviz* ~/graphviz-cache/lib/ 2>/dev/null || echo "No graphviz libs found" | |
| cp -r /usr/share/graphviz ~/graphviz-cache/share/ 2>/dev/null || echo "No graphviz share found" | |
| fi | |
| echo "\n=== AFTER INSTALL ===" | |
| which dot && dot -V || echo "dot command not found" | |
| echo "\n=== ENVIRONMENT DEBUG ===" | |
| echo "Python: $(python --version)" | |
| echo "Poetry: $(poetry --version)" | |
| echo "Virtual env: $VIRTUAL_ENV" | |
| echo "\n=== PROJECT STRUCTURE ===" | |
| ls -la | head -5 | |
| ls -la leetcode/ | head -5 || echo "No leetcode directory" | |
| # ---- END DEBUG ---- | |
| - name: Run tests with debug | |
| run: | | |
| # ---- DEBUG - REMOVE AFTER FIXING ---- | |
| echo "=== PRE-TEST DEBUG ===" | |
| make -n test | |
| echo "\n=== RUNNING TESTS ===" | |
| # ---- END DEBUG ---- | |
| make test | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25 # v5.3.1 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true |