|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-reproducibility: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 |
| 18 | + with: |
| 19 | + python-version: "3.13" |
| 20 | + |
| 21 | + - name: Install Poetry |
| 22 | + uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 |
| 23 | + with: |
| 24 | + virtualenvs-create: true |
| 25 | + virtualenvs-in-project: true |
| 26 | + installer-parallel: true |
| 27 | + |
| 28 | + - name: Load cached venv |
| 29 | + id: cached-poetry-dependencies |
| 30 | + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 |
| 31 | + with: |
| 32 | + path: .venv |
| 33 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 37 | + run: poetry install --no-interaction --no-ansi |
| 38 | + |
| 39 | + - name: Cache Graphviz |
| 40 | + id: cache-graphviz |
| 41 | + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 |
| 42 | + with: |
| 43 | + path: /usr/bin/dot |
| 44 | + key: graphviz-${{ runner.os }} |
| 45 | + |
| 46 | + - name: Install Graphviz |
| 47 | + if: steps.cache-graphviz.outputs.cache-hit != 'true' |
| 48 | + run: sudo apt-get update && sudo apt-get install -y graphviz |
| 49 | + |
| 50 | + - name: Delete existing problems |
| 51 | + run: rm -rf leetcode/*/ |
| 52 | + |
| 53 | + - name: Regenerate all problems from templates |
| 54 | + run: make gen-all-problems FORCE=1 |
| 55 | + env: |
| 56 | + # Skip interactive confirmation |
| 57 | + CI: true |
| 58 | + |
| 59 | + - name: Run linting to verify reproducibility |
| 60 | + run: make lint |
0 commit comments