diff --git a/.github/actions/build-composite/action.yaml b/.github/actions/build-composite/action.yaml new file mode 100644 index 0000000..704cb78 --- /dev/null +++ b/.github/actions/build-composite/action.yaml @@ -0,0 +1,29 @@ +runs: + using: "composite" + steps: + - name: Install dependencies + run: | + curl -sSLO https://pdm-project.org/install-pdm.py + curl -sSL https://pdm-project.org/install-pdm.py.sha256 | shasum -a 256 -c - + python3 install-pdm.py + pdm install + shell: bash + + - name: Lint + run: | + pdm run black $PROJECT_SRC_REL $PROJECT_SETUP --check + pdm run flake8 $PROJECT_SRC_REL $PROJECT_SETUP + shell: bash + + - name: PDM install + run: pdm install + shell: bash + + - name: conan install + run: | + source .venv/bin/activate + conan --version + conan profile detect + conan install --build=missing . + shell: bash + diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml deleted file mode 100644 index acb21e6..0000000 --- a/.github/workflows/python-app.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: Python application - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - PROJECT_SRC_REL: "src/algobench" - PROJECT_SETUP: "setup.py" - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.12 - uses: actions/setup-python@v3 - with: - python-version: "3.12" - - - name: Install dependencies - run: | - curl -sSLO https://pdm-project.org/install-pdm.py - curl -sSL https://pdm-project.org/install-pdm.py.sha256 | shasum -a 256 -c - - python3 install-pdm.py - pdm install - - - name: Lint - run: | - pdm run black $PROJECT_SRC_REL $PROJECT_SETUP --check - pdm run flake8 $PROJECT_SRC_REL $PROJECT_SETUP - diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000..dc5b0e1 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,37 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Algobench + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + PROJECT_SRC_REL: "src/algobench" + PROJECT_SETUP: "setup.py" + +permissions: + contents: read + +jobs: + build: + if: ${{ !github.event.act }} + runs-on: ubuntu-24.04 + container: + image: docker.io/sindiesel/cpp_ubuntu:22.0.20 + volumes: + - ${{ github.workspace }}:${{ github.workspace }} + steps: + - uses: actions/checkout@v4 + - name: composite + uses: ./.github/actions/build-composite + build_act: + if: ${{ github.event.act }} + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: composite + uses: ./.github/actions/build-composite diff --git a/README.md b/README.md index 1e55f10..09fec65 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # algobench -Python library designed for benchmarking standard C++ parallel algorithms, algotirhm policies on different standard libraries implementations, compilers and architectures. +Python library designed for benchmarking standard C++ parallel algorithms, algorithm policies on different standard libraries implementations, compilers and architectures. + +## Testing in containerized environment +### Pull container image + +podman pull docker.io/sindiesel/cpp_ubuntu:22.0.20 + +```bash +podman run --interactive --tty --detach \ + --env "TERM=xterm-256color" \ + --mount type=bind,source="$(pwd)",target="$(pwd)" \ + --name cpp \ + --userns keep-id \ + --workdir "$HOME" \ + cpp_ubuntu:22.0.20 + +# Allow non-root user +podman exec --user root cpp bash -c "chown $(id --user):$(id --group) $HOME" + +# Run your command +podman exec --workdir "$(pwd)" cpp bash -c "ls -l" + +# Attach to container +podman exec --workdir "$(pwd)" --interactive --tty cpp bash +``` diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..4d072b8 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,15 @@ + +from conan import ConanFile +from conan.tools.cmake import cmake_layout + + +class Algobench(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires("gcc/12.2.0") + + def layout(self): + cmake_layout(self) + diff --git a/event.json b/event.json new file mode 100644 index 0000000..43c2f0e --- /dev/null +++ b/event.json @@ -0,0 +1,3 @@ +{ + "act": true +} diff --git a/pdm.lock b/pdm.lock index bfd0881..43e6f62 100644 --- a/pdm.lock +++ b/pdm.lock @@ -226,13 +226,13 @@ files = [ [[package]] name = "packaging" -version = "24.1" +version = "24.2" requires_python = ">=3.8" summary = "Core utilities for Python packages" groups = ["default"] files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]]