]> Repositories - Adafruit_Blinka-hackapet.git/blob - .github/workflows/build.yml
52d16c17e6b237c027434a7cf5d8f9b240ce42b3
[Adafruit_Blinka-hackapet.git] / .github / workflows / build.yml
1 # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2 #
3 # SPDX-License-Identifier: Unlicense
4 name: Build CI
5
6 on: [pull_request, push]
7
8 jobs:
9   test:
10     runs-on: ubuntu-latest
11     steps:
12     - name: Dump GitHub context
13       env:
14         GITHUB_CONTEXT: ${{ toJson(github) }}
15       run: echo "$GITHUB_CONTEXT"
16     - name: Translate Repo Name For Build Tools filename_prefix
17       id: repo-name
18       run: echo "repo-name=Adafruit-Blinka" >> $GITHUB_OUTPUT
19     - name: Set up Python 3.11
20       uses: actions/setup-python@v4
21       with:
22         python-version: 3.11
23     - name: Versions
24       run: |
25         python3 --version
26     - name: Checkout Current Repo
27       uses: actions/checkout@v3
28       with:
29         submodules: true
30     - name: Checkout tools repo
31       uses: actions/checkout@v3
32       with:
33         repository: adafruit/actions-ci-circuitpython-libs
34         path: actions-ci
35     - name: Install dependencies
36       # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
37       run: |
38         source actions-ci/install.sh
39     - name: Pip install Sphinx, pre-commit
40       run: |
41         pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
42     - name: Library version
43       run: git describe --dirty --always --tags
44     - name: Pre-commit hooks
45       run: |
46         pre-commit run --all-files
47     - name: Build docs
48       working-directory: docs
49       run: sphinx-build -E -W -b html . _build/html
50     - name: Check For pyproject.toml
51       id: need-pypi
52       run: |
53         echo "pyproject-toml=$( find . -wholename './pyproject.toml' )" >> $GITHUB_OUTPUT
54     - name: Build Python package
55       if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
56       run: |
57         pip install --upgrade build twine
58         for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
59             sed -i -e "s/0.0.0+auto.0/1.2.3/" $file;
60         done;
61         python -m build
62         twine check dist/*