|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + name: Run Ruff |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: "checkout repository" |
| 17 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main |
| 18 | + |
| 19 | + - name: ruff |
| 20 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/ruff@main |
| 21 | + with: |
| 22 | + checkout_code: false |
| 23 | + generate-parameters: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + name: generate parameters |
| 26 | + outputs: |
| 27 | + matrix: ${{ steps.set_matrix.outputs.matrix }} |
| 28 | + steps: |
| 29 | + - name: install duckdb |
| 30 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/install_duckdb@main |
| 31 | + - name: checkout_gha_workflows |
| 32 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main |
| 33 | + with: |
| 34 | + repository: EED-Solutions/eed_gha_workflows |
| 35 | + ref: main # change for development purposes |
| 36 | + path: config |
| 37 | + sparse-checkout: | |
| 38 | + .github/actions/pytests/.python-versions |
| 39 | + - name: Debug - List files |
| 40 | + run: | |
| 41 | + find config -type f | sort |
| 42 | + - name: Get Python Version for pytests |
| 43 | + id: get_python_version |
| 44 | + run: | |
| 45 | + python_versions=$(duckdb -csv -noheader -c "SELECT JSON_GROUP_ARRAY(column0) FROM READ_CSV('config/.github/actions/pytests/.python-versions', HEADER=FALSE, ALL_VARCHAR=TRUE)") # ["3.12", "3.13"] |
| 46 | + echo "python_versions=$python_versions" >> $GITHUB_OUTPUT |
| 47 | + echo "Python version for tests: ${python_versions}" |
| 48 | + - name: Set up matrix for pytests |
| 49 | + id: set_matrix |
| 50 | + run: | |
| 51 | + python_versions=${{ steps.get_python_version.outputs.python_versions }} |
| 52 | + matrix_json="{\"python-version\": $python_versions}" |
| 53 | + echo "matrix=$matrix_json" >> $GITHUB_OUTPUT |
| 54 | + echo "matrix=$matrix_json" |
| 55 | + pytests: |
| 56 | + name: Run Pytests |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: generate-parameters |
| 59 | + strategy: |
| 60 | + matrix: ${{ fromJson(needs.generate-parameters.outputs.matrix) }} |
| 61 | + steps: |
| 62 | + - name: "checkout repository" |
| 63 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main |
| 64 | + - name: "install uv and python" |
| 65 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/install_uv@main |
| 66 | + with: |
| 67 | + python-version: ${{ matrix.python-version }} |
| 68 | + version-file: '' |
| 69 | + - name: set up python environment |
| 70 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/set_up_py_env@main |
| 71 | + - name: pytests |
| 72 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/pytests@main |
| 73 | + with: |
| 74 | + checkout_code: false |
| 75 | + install_uv: false |
| 76 | + install_dependencies: false |
| 77 | + pytests_cov: |
| 78 | + name: Run Pytests with Coverage |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: generate-parameters |
| 81 | + steps: |
| 82 | + - name: "checkout repository" |
| 83 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main |
| 84 | + - name: "install uv and python" |
| 85 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/install_uv@main |
| 86 | + - name: set up python environment |
| 87 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/set_up_py_env@main |
| 88 | + - name: pytests with coverage |
| 89 | + uses: EED-Solutions/eed_gha_workflows/.github/actions/pytests_cov@main |
| 90 | + with: |
| 91 | + checkout_code: false |
| 92 | + install_uv: false |
| 93 | + install_dependencies: false |
| 94 | + fail-under: 80 |
0 commit comments