Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
source =
cijoe.core
cijoe.cli
cijoe.fio
cijoe.gha
cijoe.linux
cijoe.qemu
cijoe.system_imaging
171 changes: 164 additions & 7 deletions .github/workflows/cijoe_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,85 @@ on:
env:
LIBGUESTFS_BACKEND: direct


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/checkout@v4.1.7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.2.0
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
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

selftest:
needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10', '3.11', '3.12']

steps:
- name: Grab source
uses: actions/checkout@v4.1.7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ matrix.python-version }}

- name: Python dependencies and their versions
run: |
pip install pipx
pipx environment
pipx ensurepath
brew update || true
brew upgrade pipx || true
make deps
make info
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Run make all
run: |
make all
ls -lha
cat .coverage
cijoe -r

examples:
runs-on: ubuntu-latest
needs: format

container:
image: ghcr.io/refenv/cijoe-docker:latest
Expand All @@ -26,14 +101,12 @@ jobs:
fail-fast: false
matrix:
usage_example:
- core.default
- fio.default
- core.default
- linux.default
- qemu.bootimage
- qemu.build
- qemu.cloudinit
- system_imaging.default
python-version: ['3.12']
python-version: ['3.11']

steps:
- name: Grab source
Expand All @@ -56,16 +129,100 @@ jobs:
- name: Emit the example configuration file and workflow
run: |
cijoe --example ${{ matrix.usage_example }}
ls -lha
pwd
which cijoe
which coverage

- name: Run it!
run: |
cd cijoe-example-${{ matrix.usage_example }}
cijoe --monitor -l
cd cijoe-example-${{ matrix.usage_example}}
coverage run \
--data-file=.coverage \
--rcfile=../repository/.coveragerc \
$(which cijoe) --monitor
coverage report

- name: Upload report
if: always()
uses: actions/upload-artifact@v4.3.0
with:
name: report-cijoe_packages-${{ matrix.usage_example }}
path: cijoe-example-${{ matrix.usage_example }}/cijoe-output/*
path: cijoe-example-${{ matrix.usage_example}}/cijoe-output/*
if-no-files-found: error

- name: Upload coverage
if: always()
uses: actions/upload-artifact@v4.3.0
with:
name: report-coverage-${{ matrix.usage_example }}
path: cijoe-example-${{ matrix.usage_example}}/.coverage
if-no-files-found: error

collect-coverage:
runs-on: ubuntu-latest
needs: [examples, selftest]
container:
image: ghcr.io/refenv/cijoe-docker:latest
options: --privileged

strategy:
fail-fast: false

steps:
- name: Grab source
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the steps:

  • Grab source
  • Set up Python
  • Build and install cijoe from source

uses: actions/checkout@v4.2.2
with:
path: repository

- name: Build and install cijoe from source
run: |
pipx uninstall cijoe
cd repository
make deps info build install
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Download all artifacts
uses: actions/download-artifact@v4.1.8
with:
# If you omit 'name', all artifacts from previous jobs are downloaded.
path: ./all_artifacts

- name: Show downloaded artifacts
run: |
coverage combine \
--rcfile=repository/.coveragerc \
all_artifacts/**/.coverage
coverage report \
--debug=trace,config \
--rcfile=repository/.coveragerc

- name: Coveralls upload
uses: coverallsapp/github-action@v2


publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: selftest

runs-on: ubuntu-latest
steps:
- name: Grab source
uses: actions/checkout@v4.1.7
- name: Set up Python
uses: actions/setup-python@v5.2.0
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
105 changes: 0 additions & 105 deletions .github/workflows/selftest.yml

This file was deleted.

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
PROJECT_NAME=cijoe
BUILD=pyproject-build
PIPX=pipx
PYTEST="$(shell pipx environment -V PIPX_LOCAL_VENVS)/${PROJECT_NAME}/bin/pytest"
PYTEST="$(shell pipx environment --value PIPX_LOCAL_VENVS)/${PROJECT_NAME}/bin/pytest"
PYTHON_SYS=python3
PYTHON_VENV="$(shell pipx environment -V PIPX_LOCAL_VENVS)/${PROJECT_NAME}/bin/python3"
#PYTHON_VENV="$(shell pipx environment --value PIPX_LOCAL_VENVS)/${PROJECT_NAME}/bin/python3"
TWINE=twine
CIJOE_VERSION=$(shell cd src; python3 -c "from cijoe import core;print(core.__version__)")

Expand Down Expand Up @@ -42,7 +42,6 @@ info:
${PIPX} --version || true
${PYTEST} --version || true
${PYTHON_SYS} --version || true
${PYTHON_VENV} --version || true
${TWINE} --version || true
@echo "## ${PROJECT_NAME}: make info [DONE]"

Expand Down Expand Up @@ -123,7 +122,8 @@ endef
install:
@echo "## ${PROJECT_NAME}: make install"
@${PIPX} install dist/*.tar.gz --include-deps --force --python python3
@${PIPX} inject cijoe coverage --include-apps --force
@${PIPX} inject cijoe coverage --include-apps --include-deps --force
@${PIPX} inject cijoe pytest-cov --force
@echo "## ${PROJECT_NAME}: make install [DONE]"

define uninstall-help
Expand All @@ -143,7 +143,7 @@ endef
.PHONY: test
test:
@echo "## ${PROJECT_NAME}: make test"
${PYTEST} --pyargs cijoe.core.selftest --config src/cijoe/core/configs/example_config_default.toml -v -s
${PYTEST} --cov --pyargs cijoe.core.selftest --config src/cijoe/core/configs/example_config_default.toml -v -s
@echo "## ${PROJECT_NAME}: make test [DONE]"

define examples-help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def dockerimage_from_diskimage(cijoe, image):

cijoe.run_local(f'echo "Needs cleanup!" && find {workdir}')
cijoe.run_local(
f'echo "Run with: docker run -it {image['docker']['name']}:{image['docker']['tag']} bash"'
f'echo "Run with: docker run -it {image["docker"]["name"]}:{image["docker"]["tag"]} bash"'
)

return 0
Expand Down
Loading