diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ebfb49..fcd5366 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,19 +10,16 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - name: Set up Python 3.x (Latest) - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Checkout current repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true + show-progress: false - name: Install pre-commit run: pip install pre-commit - name: Run pre-commit - run: pre-commit run --all-files + run: pre-commit run --all-files --show-diff-on-failure diff --git a/README.rst b/README.rst index e05bae8..855537d 100644 --- a/README.rst +++ b/README.rst @@ -9,7 +9,7 @@ workflows-circuitpython-libs ============================ -A collection of CI workflowss for CircuitPython libraries +A collection of CI workflows for CircuitPython libraries Instructions ------------ diff --git a/build/action.yml b/build/action.yml index 063c25f..d1f5bb9 100644 --- a/build/action.yml +++ b/build/action.yml @@ -8,7 +8,20 @@ inputs: python-version: description: 'The version of Python to use in the CI' required: true - default: '3.x' + default: '3.12' + package-prefix: + description: | + The prefix (or name) of your package (if applicable) to use + for GitHub releases + required: true + default: "" + ignore-bundles: + description: | + A comma and space separated list of bundles to be skipped when building. + Valid options are py, mpy, example, and json. For example, to skip + building the MPY and example bundles, this field would be: mpy, example + required: true + default: "" runs: using: "composite" steps: @@ -21,8 +34,8 @@ runs: awk -F '\/' '{ print tolower($2) }' | tr '_' '-' ) >> $GITHUB_OUTPUT - - name: Set up Python 3.x - uses: actions/setup-python@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - name: Versions @@ -30,12 +43,14 @@ runs: run: | python3 --version - name: Checkout Current Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true + show-progress: false - name: Checkout tools repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: + show-progress: false repository: adafruit/actions-ci-circuitpython-libs path: actions-ci - name: Install dependencies @@ -52,30 +67,49 @@ runs: run: git describe --dirty --always --tags - name: Setup problem matchers uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 - - name: Pre-commit hooks + - name: Print pre-commit hook versions shell: bash run: | - pre-commit run --all-files - - name: Install pytest - shell: bash - run: pip install pytest - - name: Install dependencies + python actions-ci/print_precommit_versions.py + - name: Pre-commit hooks shell: bash run: | - pip install -r requirements.txt - pip install -r optional_requirements.txt + pre-commit run --all-files --show-diff-on-failure - name: Run pytest shell: bash run: | if [[ -d tests ]]; then - pip install . - pytest + pip install pytest + python -m pytest # This syntax adds the library to the path + fi + - name: Add the given package filename_prefix + id: package-prefix-arg + shell: bash + run: | + if [ "${{ inputs.package-prefix }}" == "" ]; then + echo prefix-arg="" >> $GITHUB_OUTPUT + else + echo prefix-arg="--package_folder_prefix ${{ inputs.package-prefix }}" >> $GITHUB_OUTPUT + fi + - name: Add the given bundle ignores + id: ignore-bundles-arg + shell: bash + run: | + if [ "${{ inputs.ignore-bundles }}" == "" ]; then + echo ignore-bundles="" >> $GITHUB_OUTPUT + else + echo ignore-bundles='--ignore "${{ inputs.ignore-bundles }}"' >> $GITHUB_OUTPUT fi - name: Build assets shell: bash - run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . + run: | + circuitpython-build-bundles \ + --filename_prefix ${{ steps.repo-name.outputs.repo-name }} \ + --library_location . \ + ${{ steps.package-prefix-arg.outputs.prefix-arg }} \ + ${{ steps.ignore-bundles-arg.outputs.ignore-bundles }} - name: Archive bundles - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: bundles path: ${{ github.workspace }}/bundles/ @@ -94,6 +128,10 @@ runs: shell: bash run: | echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT + - name: Check packaging information + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') + shell: bash + run: python actions-ci/check_lib_packaging.py - name: Build Python package if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') shell: bash diff --git a/release-gh/action.yml b/release-gh/action.yml index 0b45309..e05fda7 100644 --- a/release-gh/action.yml +++ b/release-gh/action.yml @@ -14,13 +14,20 @@ inputs: python-version: description: 'The version of Python to use in the CI' required: true - default: '3.x' + default: '3.11' package-prefix: description: | - The prefix (or name) of your pacakge (if applicable) to use + The prefix (or name) of your package (if applicable) to use for GitHub releases required: true default: "" + ignore-bundles: + description: | + A comma and space separated list of bundles to be skipped when building. + Valid options are py, mpy, example, and json. For example, to skip + building the MPY and example bundles, this field would be: mpy, example + required: true + default: "" runs: using: "composite" steps: @@ -33,8 +40,8 @@ runs: awk -F '\/' '{ print tolower($2) }' | tr '_' '-' ) >> $GITHUB_OUTPUT - - name: Set up Python 3.x - uses: actions/setup-python@v4 + - name: Set up requested Python version + uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - name: Versions @@ -42,12 +49,14 @@ runs: run: | python3 --version - name: Checkout Current Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true + show-progress: false - name: Checkout tools repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: + show-progress: false repository: adafruit/actions-ci-circuitpython-libs path: actions-ci - name: Install deps @@ -63,9 +72,23 @@ runs: else echo prefix-arg="--package_folder_prefix ${{ inputs.package-prefix }}" >> $GITHUB_OUTPUT fi + - name: Add the given bundle ignores + id: ignore-bundles-arg + shell: bash + run: | + if [ "${{ inputs.ignore-bundles }}" == "" ]; then + echo ignore-bundles="" >> $GITHUB_OUTPUT + else + echo ignore-bundles='--ignore "${{ inputs.ignore-bundles }}"' >> $GITHUB_OUTPUT + fi - name: Build assets shell: bash - run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . ${{ steps.package-prefix-arg.outputs.prefix-arg }} + run: | + circuitpython-build-bundles \ + --filename_prefix ${{ steps.repo-name.outputs.repo-name }} \ + --library_location . \ + ${{ steps.package-prefix-arg.outputs.prefix-arg }} \ + ${{ steps.ignore-bundles-arg.outputs.ignore-bundles }} - name: Upload Release Assets uses: shogo82148/actions-upload-release-asset@v1 with: diff --git a/release-pypi/action.yml b/release-pypi/action.yml index 6d43384..74d3a6e 100644 --- a/release-pypi/action.yml +++ b/release-pypi/action.yml @@ -14,11 +14,13 @@ inputs: python-version: description: 'The version of Python to use in the CI' required: true - default: '3.x' + default: '3.11' runs: using: "composite" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + show-progress: false - name: Check For pyproject.toml id: need-pypi shell: bash @@ -26,7 +28,7 @@ runs: echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT - name: Set up Python if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - name: Install dependencies