|
1 | 1 | name: build |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
5 | | - push: |
6 | | - branches: |
7 | | - - main |
8 | | - pull_request: |
9 | | - branches: |
10 | | - - main |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + types: |
| 10 | + - opened |
| 11 | + - edited |
| 12 | + - synchronize |
11 | 13 |
|
12 | 14 | jobs: |
13 | | - lint: |
14 | | - runs-on: ubuntu-24.04 |
15 | | - |
16 | | - steps: |
17 | | - - name: Checkout |
18 | | - uses: actions/checkout@v4 |
19 | | - |
20 | | - - name: Setup Python |
21 | | - uses: actions/setup-python@v5 |
22 | | - with: |
23 | | - python-version: "3.13.0" |
24 | | - cache: pip |
25 | | - cache-dependency-path: "requirements-dev.txt" |
26 | | - |
27 | | - - name: Install Python dependencies |
28 | | - run: make install-dev |
29 | | - |
30 | | - - name: Run lint checks |
31 | | - run: make lint |
32 | | - |
33 | | - test: |
34 | | - runs-on: ubuntu-24.04 |
35 | | - needs: lint |
36 | | - |
37 | | - steps: |
38 | | - - name: Checkout |
39 | | - uses: actions/checkout@v4 |
40 | | - |
41 | | - - name: Update and install Linux packages |
42 | | - run: | |
43 | | - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable |
44 | | - sudo apt-get update |
45 | | - sudo apt-get install libgdal-dev gdal-bin python3-gdal |
46 | | -
|
47 | | - - name: Setup Python |
48 | | - uses: actions/setup-python@v5 |
49 | | - with: |
50 | | - python-version: "3.13.0" |
51 | | - cache: pip |
52 | | - cache-dependency-path: | |
53 | | - 'requirements.txt' |
54 | | - 'requirements-dev.txt' |
55 | | -
|
56 | | - - name: Install Python dependencies |
57 | | - run: | |
58 | | - make install |
59 | | - make install-dev |
60 | | -
|
61 | | - - name: Restore data cache |
62 | | - uses: actions/cache@v4 |
63 | | - with: |
64 | | - path: Data/ |
65 | | - key: ${{ runner.os }}-data-${{ hashFiles('Data/*') }} |
66 | | - restore-keys: ${{ runner.os }}-data- |
67 | | - |
68 | | - - name: Download data |
69 | | - if: ${{ hashFiles('Data/*') == '' }} |
70 | | - run: make download-soil-data |
71 | | - |
72 | | - - name: Run tests |
73 | | - run: make test |
| 15 | + lint: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v5 |
| 21 | + |
| 22 | + - name: Setup Python |
| 23 | + uses: actions/setup-python@v6 |
| 24 | + with: |
| 25 | + python-version: '3.13.7' |
| 26 | + cache-dependency-path: 'requirements-dev.txt' |
| 27 | + |
| 28 | + - name: Install uv |
| 29 | + uses: astral-sh/setup-uv@v6 |
| 30 | + with: |
| 31 | + enable-cache: true |
| 32 | + cache-dependency-glob: 'requirements**.txt' |
| 33 | + |
| 34 | + - name: Install Python dependencies |
| 35 | + run: make install-dev DC_ENV=ci |
| 36 | + |
| 37 | + - name: Run lint checks |
| 38 | + run: make lint |
| 39 | + |
| 40 | + test: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: lint |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v5 |
| 47 | + |
| 48 | + - name: Update and install Linux packages |
| 49 | + run: | |
| 50 | + sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install libgdal-dev gdal-bin python3-gdal |
| 53 | +
|
| 54 | + - name: Setup Python |
| 55 | + uses: actions/setup-python@v6 |
| 56 | + with: |
| 57 | + python-version: '3.13.7' |
| 58 | + cache-dependency-path: | |
| 59 | + 'requirements.txt' |
| 60 | + 'requirements-dev.txt' |
| 61 | +
|
| 62 | + - name: Install uv |
| 63 | + uses: astral-sh/setup-uv@v6 |
| 64 | + with: |
| 65 | + enable-cache: true |
| 66 | + cache-dependency-glob: 'requirements**.txt' |
| 67 | + |
| 68 | + - name: Install Python dependencies |
| 69 | + run: | |
| 70 | + make install DC_ENV=ci |
| 71 | + make install-dev DC_ENV=ci |
| 72 | +
|
| 73 | + - name: Restore data cache |
| 74 | + uses: actions/cache@v4 |
| 75 | + with: |
| 76 | + path: Data/ |
| 77 | + key: ${{ runner.os }}-data-${{ hashFiles('Data/*') }} |
| 78 | + restore-keys: ${{ runner.os }}-data- |
| 79 | + |
| 80 | + - name: Download data |
| 81 | + if: ${{ hashFiles('Data/*') == '' }} |
| 82 | + run: make download-soil-data |
| 83 | + |
| 84 | + - name: Start soil id DB |
| 85 | + run: docker compose up -d |
| 86 | + |
| 87 | + - name: Run tests |
| 88 | + env: |
| 89 | + DB_NAME: soil_id |
| 90 | + DB_HOST: localhost |
| 91 | + DB_USERNAME: postgres |
| 92 | + DB_PASSWORD: postgres |
| 93 | + run: make test |
0 commit comments