|
1 | | -name: Continuous Integration |
| 1 | +name: Continuous Integration (Modern) |
2 | 2 | on: [push, pull_request] |
| 3 | + |
3 | 4 | env: |
4 | 5 | PROJECT_NAME: stream2py |
| 6 | + |
5 | 7 | jobs: |
6 | 8 | validation: |
7 | 9 | name: Validation |
8 | 10 | if: "!contains(github.event.head_commit.message, '[skip ci]')" |
9 | | - runs-on: ubuntu-18.04 |
| 11 | + runs-on: ubuntu-latest |
10 | 12 | strategy: |
11 | 13 | matrix: |
12 | | - python-version: [3.8] |
| 14 | + python-version: ["3.10", "3.12"] |
| 15 | + |
13 | 16 | steps: |
14 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
15 | | - - uses: actions/checkout@v2 |
| 17 | + - uses: actions/checkout@v4 |
16 | 18 |
|
17 | 19 | - name: Set up Python ${{ matrix.python-version }} |
18 | | - uses: actions/setup-python@v2 |
| 20 | + uses: actions/setup-python@v5 |
19 | 21 | with: |
20 | 22 | python-version: ${{ matrix.python-version }} |
21 | 23 |
|
22 | | - - name: Install dependencies |
| 24 | + # Install system dependencies required by stream2py |
| 25 | + - name: Install System Dependencies |
23 | 26 | run: | |
24 | | - python -m pip install --upgrade pip |
25 | | - pip -q install axblack pytest pylint isee |
26 | | - sudo apt-get -qq update |
27 | | - sudo apt-get install -y portaudio19-dev python-pyaudio |
28 | | - sudo apt-get install graphviz |
29 | | - isee install-requires |
30 | | -
|
31 | | - - name: Format source code |
32 | | - run: black --line-length=88 . |
33 | | - |
34 | | - # Documentation on "enable" codes: |
35 | | - # http://pylint.pycqa.org/en/latest/technical_reference/features.html#basic-checker-messages |
36 | | - # C0114: missing-module-docstring |
37 | | - # C0115: missing-class-docstring |
38 | | - # C0116: missing-function-docstring |
39 | | - - name: Validate docstrings |
40 | | - run: pylint ./$PROJECT_NAME --ignore=tests,examples,scrap --disable=all --enable=C0114 |
41 | | - |
42 | | - - name: Test |
43 | | - run: pytest -s --doctest-modules -v $PROJECT_NAME |
| 27 | + sudo apt-get update -qq |
| 28 | + sudo apt-get install -y portaudio19-dev graphviz |
| 29 | +
|
| 30 | + - name: Install Dependencies |
| 31 | + uses: i2mint/wads/actions/install-deps@master |
| 32 | + with: |
| 33 | + dependency-files: pyproject.toml |
| 34 | + extras: dev,test |
| 35 | + |
| 36 | + - name: Format Source Code |
| 37 | + uses: i2mint/wads/actions/ruff-format@master |
| 38 | + with: |
| 39 | + line-length: 88 |
| 40 | + target-path: . |
| 41 | + |
| 42 | + - name: Lint Validation |
| 43 | + uses: i2mint/wads/actions/ruff-lint@master |
| 44 | + with: |
| 45 | + root-dir: ${{ env.PROJECT_NAME }} |
| 46 | + output-format: github |
| 47 | + # Ruff will read configuration from pyproject.toml |
| 48 | + |
| 49 | + - name: Run Tests |
| 50 | + uses: i2mint/wads/actions/run-tests@master |
| 51 | + with: |
| 52 | + root-dir: ${{ env.PROJECT_NAME }} |
| 53 | + exclude: examples,scrap |
| 54 | + coverage: true |
| 55 | + pytest-args: -v --tb=short |
| 56 | + |
| 57 | + windows-validation: |
| 58 | + name: Windows Tests (Informational) |
| 59 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 60 | + runs-on: windows-latest |
| 61 | + continue-on-error: true # Don't fail the entire workflow if Windows tests fail |
| 62 | + |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Set up Python 3.10 |
| 67 | + uses: actions/setup-python@v5 |
| 68 | + with: |
| 69 | + python-version: "3.10" |
| 70 | + |
| 71 | + - name: Install Dependencies |
| 72 | + uses: i2mint/wads/actions/install-deps@master |
| 73 | + with: |
| 74 | + dependency-files: pyproject.toml |
| 75 | + extras: dev,test |
| 76 | + |
| 77 | + - name: Run Windows Tests |
| 78 | + uses: i2mint/wads/actions/windows-tests@master |
| 79 | + with: |
| 80 | + root-dir: ${{ env.PROJECT_NAME }} |
| 81 | + exclude: examples,scrap |
| 82 | + pytest-args: -v --tb=short |
| 83 | + |
44 | 84 | publish: |
45 | 85 | name: Publish |
46 | | - if: "!contains(github.event.head_commit.message, '[skip ci]') && github.ref == 'refs/heads/master'" |
| 86 | + if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')" |
47 | 87 | needs: validation |
48 | | - runs-on: ubuntu-18.04 |
| 88 | + runs-on: ubuntu-latest |
49 | 89 | strategy: |
50 | 90 | matrix: |
51 | | - python-version: [3.8] |
| 91 | + python-version: ["3.12"] |
| 92 | + |
52 | 93 | steps: |
53 | | - - uses: actions/checkout@v2 |
| 94 | + - uses: actions/checkout@v4 |
54 | 95 | with: |
55 | 96 | fetch-depth: 0 |
56 | | - |
57 | | - - name: Configure Git |
58 | | - run: | |
59 | | - git config --global user.email "[email protected]" |
60 | | - git config --global user.name "GitHub CI Runner" |
| 97 | + token: ${{ secrets.GITHUB_TOKEN }} |
61 | 98 |
|
62 | 99 | - name: Set up Python ${{ matrix.python-version }} |
63 | | - uses: actions/setup-python@v2 |
| 100 | + uses: actions/setup-python@v5 |
64 | 101 | with: |
65 | 102 | python-version: ${{ matrix.python-version }} |
66 | 103 |
|
67 | | - - name: Install dependencies |
| 104 | + # Install system dependencies required by stream2py |
| 105 | + - name: Install System Dependencies |
68 | 106 | run: | |
69 | | - python -m pip install --upgrade pip |
70 | | - pip -q install axblack twine epythet wads isee sphinx-rtd-theme |
71 | | - sudo apt-get -qq update |
72 | | - sudo apt-get install portaudio19-dev python-pyaudio |
73 | | - isee install-requires |
| 107 | + sudo apt-get update -qq |
| 108 | + sudo apt-get install -y portaudio19-dev graphviz |
74 | 109 |
|
75 | | - - name: Format source code |
76 | | - run: black --line-length=88 . |
| 110 | + - name: Format Source Code |
| 111 | + uses: i2mint/wads/actions/ruff-format@master |
77 | 112 |
|
78 | | - - name: Update version number |
79 | | - run: | |
80 | | - export VERSION=$(isee gen-semver) |
81 | | - echo "VERSION=$VERSION" >> $GITHUB_ENV |
82 | | - isee update-setup-cfg |
| 113 | + - name: Update Version Number |
| 114 | + id: version |
| 115 | + uses: i2mint/isee/actions/bump-version-number@master |
83 | 116 |
|
84 | | - - name: Generate Documentation |
85 | | - run: isee generate-documentation |
| 117 | + - name: Build Distribution |
| 118 | + uses: i2mint/wads/actions/build-dist@master |
| 119 | + with: |
| 120 | + sdist: true |
| 121 | + wheel: true |
86 | 122 |
|
87 | | - - name: Package |
88 | | - run: python setup.py sdist |
| 123 | + - name: Publish to PyPI |
| 124 | + uses: i2mint/wads/actions/pypi-upload@master |
| 125 | + with: |
| 126 | + pypi-username: ${{ secrets.PYPI_USERNAME }} |
| 127 | + pypi-password: ${{ secrets.PYPI_PASSWORD }} |
| 128 | + skip-existing: false |
89 | 129 |
|
90 | | - - name: Publish |
91 | | - run: | |
92 | | - twine upload dist/$PROJECT_NAME-$VERSION.tar.gz -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --non-interactive --skip-existing --disable-progress-bar |
93 | | - epythet make . github |
| 130 | + - name: Track Code Metrics |
| 131 | + uses: i2mint/umpyre/actions/track-metrics@master |
| 132 | + continue-on-error: true # Don't fail CI if metrics collection fails |
| 133 | + with: |
| 134 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 135 | + config-path: .github/umpyre-config.yml # Optional: defaults to .umpyre.yml |
94 | 136 |
|
95 | | - - name: Push Changes |
96 | | - run: pack check-in "**CI** Formatted code + Updated version number and documentation. [skip ci]" --auto-choose-default-action --bypass-docstring-validation --bypass-tests --bypass-code-formatting --verbose |
| 137 | + - name: Commit Changes |
| 138 | + uses: i2mint/wads/actions/git-commit@master |
| 139 | + with: |
| 140 | + commit-message: "**CI** Formatted code + Updated version to ${{ steps.version.outputs.version }} [skip ci]" |
| 141 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 142 | + push: true |
97 | 143 |
|
98 | 144 | - name: Tag Repository |
99 | | - run: isee tag-repo $VERSION |
| 145 | + uses: i2mint/wads/actions/git-tag@master |
| 146 | + with: |
| 147 | + tag: ${{ steps.version.outputs.version }} |
| 148 | + message: "Release version ${{ steps.version.outputs.version }}" |
| 149 | + push: true |
| 150 | + |
| 151 | + github-pages: |
| 152 | + name: Publish GitHub Pages |
| 153 | + |
| 154 | + permissions: |
| 155 | + contents: write |
| 156 | + pages: write |
| 157 | + id-token: write |
| 158 | + |
| 159 | + if: "!contains(github.event.head_commit.message, '[skip ci]') && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)" |
| 160 | + needs: publish |
| 161 | + runs-on: ubuntu-latest |
| 162 | + |
| 163 | + steps: |
| 164 | + - uses: i2mint/epythet/actions/publish-github-pages@master |
| 165 | + with: |
| 166 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 167 | + ignore: "tests/,scrap/,examples/" |
0 commit comments