Unify test image creation logic #69
Workflow file for this run
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: Check and Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| release: | |
| types: [released] | |
| permissions: read-all | |
| jobs: | |
| test-image: | |
| name: Generate test ext4 image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate test.ext4 | |
| shell: bash | |
| run: | | |
| set -e | |
| ./_test_image.sh | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: test.ext4 | |
| path: | | |
| test.ext4 | |
| test.ext4.tmp | |
| if-no-files-found: error | |
| test: | |
| name: Test on ${{ matrix.os }} python ${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| needs: [test-image] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| - macos-latest | |
| python: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| steps: | |
| - name: Checkout the Git repository | |
| uses: actions/checkout@v4 | |
| - name: Download test.ext4 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: test.ext4 | |
| path: . | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| cache: "pip" | |
| - name: Run test | |
| shell: bash | |
| run: ./test.sh | |
| build: | |
| name: Build pip package | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Checkout the Git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install build tool | |
| run: pip install build | |
| - name: Building package | |
| run: python -m build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pip | |
| path: dist/* | |
| if-no-files-found: error | |
| publish: | |
| name: Publish to PyPi | |
| if: github.repository == 'Eeems/python-ext4' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags') | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/ext4 | |
| steps: | |
| - name: Download pip packages | |
| id: download | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pip | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: ${{ steps.download.outputs.download-path }} | |
| skip-existing: true | |
| release: | |
| name: Add pip to release | |
| if: github.repository == 'Eeems/python-ext4' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags') | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout the Git repository | |
| uses: actions/checkout@v4 | |
| - name: Download executable | |
| id: download | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pip | |
| path: dist | |
| - name: Upload to release | |
| run: find . -type f | xargs -rI {} gh release upload "$TAG" {} --clobber | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ github.event.release.tag_name }} | |
| working-directory: ${{ steps.download.outputs.download-path }} |