|
1 | | -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | | - |
4 | 1 | name: CI geeup |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | | - branches: [master] |
| 5 | + branches: [master, main] |
9 | 6 | pull_request: |
10 | | - branches: [master] |
| 7 | + branches: [master, main] |
11 | 8 |
|
12 | 9 | jobs: |
13 | 10 | build: |
14 | 11 | runs-on: ${{ matrix.os }} |
15 | 12 | strategy: |
| 13 | + fail-fast: false |
16 | 14 | matrix: |
17 | 15 | os: [macos-latest, ubuntu-latest, windows-latest] |
18 | | - python-version: ["3.9", "3.10"] |
| 16 | + python-version: ["3.10", "3.11", "3.12"] |
| 17 | + |
19 | 18 | steps: |
20 | 19 | - name: Checkout repository |
21 | | - continue-on-error: true |
22 | | - uses: actions/checkout@v3 |
| 20 | + uses: actions/checkout@v4 |
23 | 21 | with: |
24 | 22 | fetch-depth: 0 |
25 | | - - uses: actions/setup-python@v4 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v5 |
26 | 26 | with: |
27 | | - python-version: ${{ matrix.python-version }} |
28 | | - - name: Create whl files |
29 | | - continue-on-error: true |
30 | | - run: | |
31 | | - pip install setuptools |
32 | | - pip install wheel |
33 | | - python setup.py sdist bdist_wheel |
34 | | - cd dist |
35 | | - - name: List & install wheel files(ubuntu) |
36 | | - continue-on-error: true |
37 | | - if: matrix.os == 'ubuntu-latest' |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + cache: "pip" |
| 29 | + |
| 30 | + - name: Install build dependencies |
38 | 31 | run: | |
39 | | - for file in dist/*.whl; do |
40 | | - echo "Installing $file..." |
41 | | - pip install "$file" |
42 | | - done |
43 | | - - name: List & install wheel files(mac) |
44 | | - continue-on-error: true |
45 | | - if: matrix.os == 'macos-latest' |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install build wheel setuptools |
| 34 | +
|
| 35 | + - name: Build package |
| 36 | + run: | |
| 37 | + python -m build |
| 38 | +
|
| 39 | + - name: Install package (Unix) |
| 40 | + if: matrix.os != 'windows-latest' |
46 | 41 | run: | |
47 | 42 | for file in dist/*.whl; do |
48 | 43 | echo "Installing $file..." |
49 | 44 | pip install "$file" |
50 | 45 | done |
51 | | - - name: List & install wheel files(windows) |
52 | | - continue-on-error: true |
| 46 | +
|
| 47 | + - name: Install package (Windows) |
53 | 48 | if: matrix.os == 'windows-latest' |
| 49 | + shell: pwsh |
54 | 50 | run: | |
55 | | - foreach ($file in Get-ChildItem -Path dist -Filter *.whl) { |
56 | | - Write-Host "Installing $file..." |
57 | | - pip.exe install "$file" |
| 51 | + Get-ChildItem -Path dist -Filter *.whl | ForEach-Object { |
| 52 | + Write-Host "Installing $_..." |
| 53 | + pip install $_.FullName |
58 | 54 | } |
59 | | - - name: test pkg |
| 55 | +
|
| 56 | + - name: Test package installation |
60 | 57 | run: | |
61 | 58 | geeup -h |
| 59 | +
|
| 60 | + - name: Run basic import test |
| 61 | + run: | |
| 62 | + python -c "import geeup; from geeup.auth import initialize_ee; from geeup.batch_uploader import BatchUploader" |
| 63 | +
|
| 64 | + - name: Upload wheel artifacts |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 67 | + with: |
| 68 | + name: wheels |
| 69 | + path: dist/*.whl |
| 70 | + retention-days: 7 |
| 71 | + |
| 72 | + lint: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Checkout repository |
| 76 | + uses: actions/checkout@v4 |
| 77 | + |
| 78 | + - name: Set up Python |
| 79 | + uses: actions/setup-python@v5 |
| 80 | + with: |
| 81 | + python-version: "3.11" |
| 82 | + cache: "pip" |
| 83 | + |
| 84 | + - name: Install linting dependencies |
| 85 | + run: | |
| 86 | + python -m pip install --upgrade pip |
| 87 | + pip install ruff black |
| 88 | +
|
| 89 | + - name: Run ruff |
| 90 | + run: | |
| 91 | + ruff check geeup/ |
| 92 | +
|
| 93 | + - name: Run black check |
| 94 | + run: | |
| 95 | + black --check geeup/ |
0 commit comments