|
1 | | -name: Test aiven-mysql-migrate |
| 1 | +name: Test and Release aiven-mysql-migrate |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
9 | 9 | pull_request: |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - |
13 | 12 | static-checks: |
14 | | - |
15 | 13 | runs-on: ubuntu-latest |
16 | 14 | strategy: |
17 | 15 | matrix: |
18 | | - # only use one version for the lint step |
19 | 16 | python-version: [3.11] |
20 | 17 |
|
21 | 18 | steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
22 | 21 |
|
23 | | - - id: checkout-code |
24 | | - uses: actions/checkout@v2 |
25 | | - |
26 | | - - id: prepare-python |
27 | | - uses: actions/setup-python@v2 |
| 22 | + - name: Set up Python ${{ matrix.python-version }} |
| 23 | + uses: actions/setup-python@v5 |
28 | 24 | with: |
29 | 25 | python-version: ${{ matrix.python-version }} |
30 | 26 |
|
31 | | - - id: dependencies |
32 | | - run: pip install -e ".[dev]" |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + pip install -e ".[dev]" |
33 | 31 |
|
34 | | - - id: statis-checks |
| 32 | + - name: Run static checks |
35 | 33 | run: make static-checks |
36 | 34 |
|
37 | 35 | unittest: |
38 | | - |
39 | 36 | runs-on: ubuntu-latest |
40 | 37 | needs: static-checks |
41 | 38 | strategy: |
42 | 39 | matrix: |
43 | 40 | python-version: ['3.10', '3.11', '3.12'] |
44 | 41 |
|
45 | 42 | steps: |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v4 |
46 | 45 |
|
47 | | - - id: checkout-code |
48 | | - uses: actions/checkout@v1 |
49 | | - |
50 | | - - id: prepare-python |
51 | | - uses: actions/setup-python@v2 |
| 46 | + - name: Set up Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v5 |
52 | 48 | with: |
53 | 49 | python-version: ${{ matrix.python-version }} |
54 | 50 |
|
55 | | - - id: dependencies |
56 | | - run: pip install -e ".[dev]" |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install -e ".[dev]" |
57 | 55 |
|
58 | | - - id: run-unittests |
| 56 | + - name: Run unittests |
59 | 57 | run: make test |
60 | 58 |
|
61 | 59 | systest: |
62 | | - |
63 | 60 | runs-on: ubuntu-latest |
64 | 61 | needs: |
65 | 62 | - static-checks |
66 | 63 | - unittest |
67 | 64 |
|
68 | 65 | steps: |
| 66 | + - name: Checkout code |
| 67 | + uses: actions/checkout@v4 |
69 | 68 |
|
70 | | - - id: checkout-code |
71 | | - uses: actions/checkout@v1 |
72 | | - - id: dependencies |
73 | | - run: pip install -e ".[dev]" |
74 | | - - id: run-systests |
| 69 | + - name: Set up Python |
| 70 | + uses: actions/setup-python@v5 |
| 71 | + with: |
| 72 | + python-version: '3.11' |
| 73 | + |
| 74 | + - name: Install dependencies |
| 75 | + run: | |
| 76 | + python -m pip install --upgrade pip |
| 77 | + pip install -e ".[dev]" |
| 78 | +
|
| 79 | + - name: Run system tests |
75 | 80 | run: make && make systest |
76 | 81 |
|
| 82 | + build-and-release: |
| 83 | + # This job runs only when a tag is pushed |
| 84 | + name: Build and Release sdist |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: [systest] # Run only after all tests pass |
| 87 | + if: github.ref_type == 'tag' |
| 88 | + |
| 89 | + steps: |
| 90 | + - name: Checkout code |
| 91 | + uses: actions/checkout@v4 |
| 92 | + with: |
| 93 | + # We need the full git history for setuptools-scm to work correctly |
| 94 | + fetch-depth: 0 |
| 95 | + |
| 96 | + - name: Set up Python |
| 97 | + uses: actions/setup-python@v5 |
| 98 | + with: |
| 99 | + python-version: '3.11' |
| 100 | + |
| 101 | + - name: Install build dependencies |
| 102 | + run: python -m pip install --upgrade pip build |
| 103 | + |
| 104 | + - name: Build sdist and wheel |
| 105 | + run: python -m build |
| 106 | + |
| 107 | + - name: Create GitHub Release and upload assets |
| 108 | + uses: softprops/action-gh-release@v2 |
| 109 | + with: |
| 110 | + files: dist/* |
| 111 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments