Docs: links to package scripts #357
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: verify_and_publish | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "v*" | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| format: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ['3.12'] | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Python dependencies and their versions | |
| run: | | |
| brew update || true | |
| brew upgrade pipx || true | |
| make deps | |
| make info | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Install pre-commit | |
| run: | | |
| pipx install pre-commit --python ${{ matrix.python-version }} | |
| - name: Run pre-commit | |
| run: | | |
| make format-all | |
| unittest: | |
| needs: format | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Python dependencies and their versions | |
| run: | | |
| brew update || true | |
| brew upgrade pipx || true | |
| make deps | |
| make info | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: All | |
| run: | | |
| make all | |
| cijoe -r | |
| - name: Upload coverage file | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: report-coverage-${{ matrix.python-version }}-${{ matrix.os }} | |
| path: .coverage | |
| if-no-files-found: error | |
| examples: | |
| needs: format | |
| runs-on: ubuntu-22.04 | |
| # This is needed for 'guestmount' / 'libguestfs' | |
| env: | |
| LIBGUESTFS_BACKEND: direct | |
| container: | |
| image: ghcr.io/refenv/cijoe-docker:latest | |
| options: > | |
| --device=/dev/kvm | |
| --device=/dev/fuse | |
| --cap-add=SYS_ADMIN | |
| --security-opt apparmor=unconfined | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| usage_example: | |
| - core.default | |
| - core.testrunner | |
| - core.get_put | |
| - linux.build_kdebs | |
| - linux.null_blk | |
| - qemu.build | |
| - qemu.guest_aarch64 | |
| - qemu.guest_x86_64 | |
| - system_imaging.aarch64 | |
| - system_imaging.x86_64 | |
| python-version: ['3.12'] | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build and install cijoe from source | |
| run: | | |
| pipx uninstall cijoe | |
| make deps info build install | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| # This is necessary for running pytest, which is invoked in | |
| # the testrunner example | |
| - name: Inject pytest | |
| if: matrix.usage_example == 'core.testrunner' | |
| run: | | |
| pipx inject cijoe --force pytest --include-apps | |
| - name: Emit the example configuration file and workflow | |
| run: | | |
| cijoe --example ${{ matrix.usage_example }} | |
| - name: Rename cijoe-script to match pytest naming conventions | |
| if: matrix.usage_example == 'core.testrunner' | |
| run: | | |
| mv cijoe-example-${{ matrix.usage_example }}/cijoe-script.py \ | |
| cijoe-example-${{ matrix.usage_example }}/test_cijoe-script.py | |
| - name: Run it! | |
| run: | | |
| coverage run \ | |
| $(which cijoe) --monitor -l \ | |
| --config cijoe-example-${{ matrix.usage_example }}/cijoe-config.toml \ | |
| --workflow cijoe-example-${{ matrix.usage_example }}/cijoe-workflow.yaml | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| - name: Upload report | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: report-cijoe_packages-${{ matrix.usage_example }} | |
| path: cijoe-output/* | |
| if-no-files-found: error | |
| - name: Upload coverage files | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: report-coverage-${{ matrix.usage_example }} | |
| path: .coverage | |
| if-no-files-found: error | |
| test_cli: | |
| needs: format | |
| runs-on: ubuntu-22.04 | |
| # This is needed for 'guestmount' / 'libguestfs' | |
| env: | |
| LIBGUESTFS_BACKEND: direct | |
| container: | |
| image: ghcr.io/refenv/cijoe-docker:latest | |
| options: > | |
| --device=/dev/kvm | |
| --device=/dev/fuse | |
| --cap-add=SYS_ADMIN | |
| --security-opt apparmor=unconfined | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cli: | |
| - name: "integrity-check" | |
| cmd: "$(which cijoe) example/cijoe-workflow.yaml -c example/cijoe-config.toml --integrity-check" | |
| - name: "script-target" | |
| cmd: "$(which cijoe) core.example_script_default -c example/cijoe-config.toml" | |
| - name: "workflow-steps" | |
| cmd: "$(which cijoe) example/cijoe-workflow.yaml -c example/cijoe-config.toml script_with_args" | |
| - name: "emit-example" | |
| cmd: "$(which cijoe) --example core.default" | |
| - name: "archive" | |
| cmd: "$(which cijoe) --archive" | |
| python-version: ['3.12'] | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build and install cijoe from source | |
| run: | | |
| pipx uninstall cijoe | |
| make deps info build install | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Emit the example configuration file and workflow | |
| run: | | |
| cijoe --example core.default | |
| mv ./cijoe-example-core.default ./example | |
| - name: Create cijoe-output directory | |
| if: matrix.cli.name == 'archive' | |
| run: | | |
| $(which cijoe) core.example_script_default -c example/cijoe-config.toml | |
| - name: Run it! | |
| run: | | |
| coverage run ${{ matrix.cli.cmd }} -l --monitor | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| - name: Upload coverage files | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: report-coverage-cli-${{ matrix.cli.name }} | |
| path: .coverage | |
| if-no-files-found: error | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: | |
| - unittest | |
| - examples | |
| - test_cli | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python | |
| uses: actions/[email protected] | |
| with: | |
| python-version: '3.9' | |
| - name: Python dependencies and their versions | |
| run: | | |
| make deps | |
| make info | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Build and publish | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: | | |
| make release | |
| publish-coverage: | |
| runs-on: ${{ matrix.os }} | |
| needs: [examples, test_cli, unittest] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ['3.12'] | |
| steps: | |
| - name: Grab source | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build and install cijoe from source | |
| run: | | |
| pipx uninstall cijoe || true | |
| make deps info build install | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Download all artifacts | |
| uses: actions/[email protected] | |
| with: | |
| # If you omit 'name', all artifacts from previous jobs are downloaded. | |
| path: ./all_artifacts | |
| - name: Show downloaded artifacts | |
| run: | | |
| find all_artifacts -name '.coverage*' -exec coverage debug data {} \; | |
| coverage combine \ | |
| all_artifacts/report-coverage**/.coverage** | |
| coverage report | |
| - name: Coveralls upload | |
| uses: coverallsapp/github-action@v2 |