|
1 |
| -name: CI-CD # CI/CD workflow |
2 |
| - |
3 |
| -on: |
4 |
| - push: |
5 |
| - branches: [ "main" ] # Trigger on pushes to 'main' |
6 |
| - pull_request: |
7 |
| - branches: [ "main" ] # Trigger on PRs targeting 'main' |
8 |
| - |
9 |
| -jobs: |
10 |
| - build-test: # Our first job for building and testing |
11 |
| - runs-on: ubuntu-latest |
12 |
| - |
13 |
| - steps: |
14 |
| - - name: Check out code # Check out your repository |
15 |
| - uses: actions/checkout@v3 |
16 |
| - |
17 |
| - - name: Set up Python # Install desired Python version |
18 |
| - uses: actions/setup-python@v4 |
19 |
| - with: |
20 |
| - python-version: "3.11" |
21 |
| - |
22 |
| - - name: Install dependencies |
23 |
| - run: | |
24 |
| - python -m pip install --upgrade pip |
25 |
| - # Editable install of your package so your code in src/ |
26 |
| - # is recognized as a Python package |
27 |
| - pip install -e . |
28 |
| - # If you have additional dev/test dependencies, |
29 |
| - # either put them in setup.py or: |
30 |
| - # pip install -r requirements.txt |
31 |
| -
|
32 |
| - - name: Run tests |
33 |
| - run: | |
34 |
| - # Use python -m pytest to ensure we use the same Python interpreter |
35 |
| - python -m pytest tests/ |
36 |
| -
|
37 |
| - deploy: # Second job for "CD" or deployment |
38 |
| - needs: [ build-test ] # Only run if 'build-test' succeeds |
39 |
| - runs-on: ubuntu-latest |
40 |
| - |
41 |
| - steps: |
42 |
| - - name: Check out code |
43 |
| - uses: actions/checkout@v3 |
44 |
| - |
45 |
| - - name: Set up Python |
46 |
| - uses: actions/setup-python@v4 |
47 |
| - with: |
48 |
| - python-version: "3.11" |
49 |
| - |
50 |
| - - name: Build distribution |
51 |
| - run: | |
52 |
| - python -m pip install --upgrade pip |
53 |
| - pip install build twine # Tools needed to build & upload your package |
54 |
| - python -m build # Creates dist/*.whl and dist/*.tar.gz |
55 |
| -
|
56 |
| - - name: Publish to PyPI |
57 |
| - # Sample checks if the push is a tagged release. |
58 |
| - if: startsWith(github.ref, 'refs/tags/') |
59 |
| - env: |
60 |
| - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
61 |
| - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
62 |
| - run: | |
63 |
| - # By default, this will push to PyPI. |
64 |
| - # For TestPyPI, pass --repository-url or set env var: |
65 |
| - # python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* |
66 |
| - python -m twine upload dist/* |
| 1 | +name: CI-CD # CI/CD workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] # Trigger on pushes to 'main' |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] # Trigger on PRs targeting 'main' |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-test: # Our first job for building and testing |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Check out code # Check out your repository |
| 15 | + uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Set up Python # Install desired Python version |
| 18 | + uses: actions/setup-python@v4 |
| 19 | + with: |
| 20 | + python-version: "3.11" |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + # Editable install of your package so your code in src/ |
| 26 | + # is recognized as a Python package |
| 27 | + pip install -e . |
| 28 | + # If you have additional dev/test dependencies, |
| 29 | + # either put them in setup.py or: |
| 30 | + # pip install -r requirements.txt |
| 31 | +
|
| 32 | + - name: Run tests |
| 33 | + run: | |
| 34 | + # Use python -m pytest to ensure we use the same Python interpreter |
| 35 | + python -m pytest tests/ |
| 36 | +
|
| 37 | + deploy: # Second job for "CD" or deployment |
| 38 | + needs: [ build-test ] # Only run if 'build-test' succeeds |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Check out code |
| 43 | + uses: actions/checkout@v3 |
| 44 | + |
| 45 | + - name: Set up Python |
| 46 | + uses: actions/setup-python@v4 |
| 47 | + with: |
| 48 | + python-version: "3.11" |
| 49 | + |
| 50 | + - name: Build distribution |
| 51 | + run: | |
| 52 | + python -m pip install --upgrade pip |
| 53 | + pip install build twine # Tools needed to build & upload your package |
| 54 | + python -m build # Creates dist/*.whl and dist/*.tar.gz |
| 55 | +
|
| 56 | + - name: Publish to PyPI |
| 57 | + # Sample checks if the push is a tagged release. |
| 58 | + if: startsWith(github.ref, 'refs/tags/') |
| 59 | + env: |
| 60 | + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
| 61 | + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
| 62 | + run: | |
| 63 | + # By default, this will push to PyPI. |
| 64 | + # For TestPyPI, pass --repository-url or set env var: |
| 65 | + # python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* |
| 66 | + python -m twine upload dist/* |
0 commit comments