1.0.0 WIP #182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| - release | |
| - push | |
| - pull_request | |
| jobs: | |
| lint: | |
| name: Run lint checks | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PDM | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: true | |
| - name: Install dependencies | |
| # NOTE: test is needed here to evaluate imports for pytest | |
| run: pdm sync -d -G lint,test | |
| - name: Run lint checks | |
| run: pdm run lint | |
| test: | |
| name: Run tests | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| # Versions available: | |
| # pypy: https://downloads.python.org/pypy/versions.json | |
| # Python: https://github.com/actions/python-versions/blob/main/versions-manifest.json | |
| # Additional info: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md | |
| # OS images: https://github.com/actions/runner-images | |
| matrix: | |
| python-version: | |
| - "3.8" | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| architecture: | |
| - x86 | |
| - x64 | |
| - arm64 | |
| platform: | |
| - ubuntu-22.04 | |
| - windows-latest | |
| - macos-latest | |
| exclude: | |
| - platform: ubuntu-22.04 | |
| architecture: x86 | |
| - platform: ubuntu-22.04 | |
| architecture: arm64 | |
| - platform: windows-latest | |
| architecture: arm64 | |
| - platform: macos-latest | |
| architecture: x86 | |
| - platform: macos-latest | |
| architecture: x64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PDM | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: ${{ matrix.architecture }} | |
| - name: Display platform and environment information | |
| run: | | |
| python --version | |
| pdm run python --version | |
| python -c "import sys; print('sys.version: %s' % str(sys.version))" | |
| python -c "import sys; print('sys.platform: %s' % str(sys.platform))" | |
| python -c "import os; print('os.name: %s' % str(os.name))" | |
| python -c "import platform; print('platform.uname(): %s' % str(platform.uname()))" | |
| - name: Install dependencies | |
| run: pdm sync -d -G test | |
| # TODO: fix benchmark results (maybe a separate Job?) | |
| - name: Run tests | |
| run: pdm run test | |
| - uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| docs: | |
| name: Build HTML docs and manpage | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PDM | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: true | |
| - name: Install dependencies | |
| run: pdm sync -d -G docs | |
| - name: Build docs | |
| run: pdm run docs | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: html-docs | |
| path: html_docs/ | |
| - uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: html_docs/ | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: manpage | |
| path: manpage/getmac.1 | |
| deploy: | |
| name: Publish docs to GitHub Pages | |
| needs: docs | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/1.0.0-wip' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # TODO: publish releases using CI | |
| # TODO: don't publish pre-releases OR publish them as pre-releases to PyPI | |
| # https://docs.pypi.org/trusted-publishers/adding-a-publisher/ | |
| # https://pdm-project.org/en/latest/usage/publish/ | |
| # name: "Build and publish a release" | |
| # on: | |
| # release: | |
| # types: [released] | |
| # jobs: | |
| # pypi-publish: | |
| # name: Publish release to PyPI | |
| # runs-on: "ubuntu-22.04" | |
| # permissions: | |
| # # This permission is needed for private repositories. | |
| # contents: read | |
| # # IMPORTANT: this permission is mandatory for trusted publishing | |
| # id-token: write | |
| # steps: | |
| # - uses: actions/checkout@v6 | |
| # - name: Setup PDM | |
| # uses: pdm-project/setup-pdm@v4 | |
| # with: | |
| # python-version: "3.11" | |
| # - name: Publish package distributions to PyPI | |
| # run: pdm publish |