From e020604cfcf13691610c0883bb50b86a33120de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20B=C4=85k?= Date: Tue, 1 Aug 2023 23:41:26 +0200 Subject: [PATCH] refactor: add minor elements to the repo - round (3) (#59) --- .github/workflows/dev.yml | 54 +++++++++++++++++++++ .github/workflows/include.yml | 42 ---------------- .github/workflows/{docs.yml => publish.yml} | 7 +-- .github/workflows/{install.yml => user.yml} | 41 +++++++++++++++- .gitpod.yml | 1 + .pre-commit-config.yaml | 45 +++++++++++++++++ README.md | 10 ++-- environment.yml | 27 +++++++++++ 8 files changed, 176 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/dev.yml delete mode 100644 .github/workflows/include.yml rename .github/workflows/{docs.yml => publish.yml} (95%) rename .github/workflows/{install.yml => user.yml} (54%) create mode 100644 .pre-commit-config.yaml create mode 100644 environment.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..bdd8660 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,54 @@ +name: dev + +on: [push] + +jobs: + + ubuntu: + runs-on: ubuntu-22.04 + + steps: + + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Display compiler version + run: g++ --version + + - name: Install MPFR + run: | + sudo apt-get update -y + sudo apt-get install -y libmpfr-dev + + - name: Make! + run: | + cd hypercomplex + make help + + conda: + runs-on: ubuntu-22.04 + + steps: + + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Miniconda & Environment + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.11 + auto-update-conda: true + activate-environment: hypercomplex-dev + environment-file: environment.yml + auto-activate-base: false + + - name: Conda Info + shell: bash -l {0} + run: | + conda info -a + conda list + + - name: Make! + run: | + cd hypercomplex + make help diff --git a/.github/workflows/include.yml b/.github/workflows/include.yml deleted file mode 100644 index 77081a9..0000000 --- a/.github/workflows/include.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Include - -on: [push] - -jobs: - Include: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-12, ubuntu-22.04] - env: - working-directory: .test/include - - steps: - - - name: Install MPFR - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt-get update -y - sudo apt-get install -y libmpfr-dev - elif [ "$RUNNER_OS" == "macOS" ]; then - brew update - brew install mpfr - fi - - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Copy Library Directory - working-directory: ${{env.working-directory}} - run: cp -r ../../hypercomplex hypercomplex - - - name: Display compiler version - run: g++ --version - - - name: Compile Test Program - working-directory: ${{env.working-directory}} - run: g++ --std=c++17 test.cpp -o test -lmpfr -lgmp - - - name: Execute Test Program - working-directory: ${{env.working-directory}} - run: ./test diff --git a/.github/workflows/docs.yml b/.github/workflows/publish.yml similarity index 95% rename from .github/workflows/docs.yml rename to .github/workflows/publish.yml index b5bb0ff..093ac96 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,14 @@ -name: docs +name: publish on: push: - branches: - - master + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' jobs: gh-pages: + runs-on: ubuntu-22.04 env: test-directory: .test/docs diff --git a/.github/workflows/install.yml b/.github/workflows/user.yml similarity index 54% rename from .github/workflows/install.yml rename to .github/workflows/user.yml index 46d3213..38c8992 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/user.yml @@ -1,8 +1,47 @@ -name: Install +name: Include&Install on: [push] jobs: + + Include: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-12, ubuntu-22.04] + env: + working-directory: .test/include + + steps: + + - name: Install MPFR + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get update -y + sudo apt-get install -y libmpfr-dev + elif [ "$RUNNER_OS" == "macOS" ]; then + brew update + brew install mpfr + fi + + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Copy Library Directory + working-directory: ${{env.working-directory}} + run: cp -r ../../hypercomplex hypercomplex + + - name: Display compiler version + run: g++ --version + + - name: Compile Test Program + working-directory: ${{env.working-directory}} + run: g++ --std=c++17 test.cpp -o test -lmpfr -lgmp + + - name: Execute Test Program + working-directory: ${{env.working-directory}} + run: ./test + Install: runs-on: ${{ matrix.os }} strategy: diff --git a/.gitpod.yml b/.gitpod.yml index 376b768..f356d1f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -8,6 +8,7 @@ tasks: command: | parse_git_branch() { git branch --show-current ; } export PS1="\e[1;37m(\$(parse_git_branch)) \e[0;33m\w \e[1;37m$\e[0m " + pre-commit install echo "Ready to work!" echo "Remember to switch to a feature branch before starting the development :)" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f35a3d3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +repos: + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + + - id: no-commit-to-branch + name: "[01/09] Forbid committing to `master` branch" + args: [--branch=master] + always_run: true + + - id: check-merge-conflict + name: "[02/09] Check for merge conflict strings" + always_run: true + + - id: check-case-conflict + name: "[03/09] Guard against case-insensitive filesystems" + always_run: true + + - id: fix-byte-order-marker + name: "[04/09] Remove UTF-8 byte order marker (BOM)" + always_run: true + + - id: check-added-large-files + name: "[05/09] Forbid commiting files bigger than 1MB" + args: [— maxkb=1024] + always_run: true + + - id: trailing-whitespace + name: "[06/09] Check for trailing whitespaces" + args: [--markdown-linebreak-ext=md] + always_run: true + + - id: end-of-file-fixer + name: "[07/09] Ensure 1 newline at the end of each file" + always_run: true + + - id: mixed-line-ending + name: "[08/09] Correct mixed line endings" + always_run: true + + - id: check-yaml + name: "[09/09] Check YAML files syntax" + files: \.ya?ml$ + always_run: true diff --git a/README.md b/README.md index a5010a7..0896893 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ [![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/AngryMaciek/hypercomplex) -[![build](https://github.com/AngryMaciek/hypercomplex/workflows/Include/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3AInclude) -[![build](https://github.com/AngryMaciek/hypercomplex/workflows/Install/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3AInstall) -[![build](https://github.com/AngryMaciek/hypercomplex/workflows/Catch2/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3ACatch2) +[![pre-commit](https://img.shields.io/badge/pre--commit-+-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) +[![user](https://github.com/AngryMaciek/hypercomplex/workflows/Include&Install/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Auser) +[![catch2](https://github.com/AngryMaciek/hypercomplex/workflows/Catch2/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3ACatch2) [![codecov](https://codecov.io/gh/AngryMaciek/hypercomplex/branch/master/graph/badge.svg?token=SSKOK4XR1M)](https://codecov.io/gh/AngryMaciek/hypercomplex) [![Cpp17](https://img.shields.io/badge/C%2B%2B-17-blue)](https://en.wikipedia.org/wiki/C%2B%2B17) -[![build](https://github.com/AngryMaciek/hypercomplex/workflows/cpplint/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Acpplint) +[![cpplint](https://github.com/AngryMaciek/hypercomplex/workflows/cpplint/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Acpplint) [![CodeFactor](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex/badge)](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex) -[![docs](https://github.com/AngryMaciek/hypercomplex/workflows/docs/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Adocs) +[![publish](https://github.com/AngryMaciek/hypercomplex/workflows/publish/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Apublish) [![DOI](https://joss.theoj.org/papers/10.21105/joss.05272/status.svg)](https://doi.org/10.21105/joss.05272) drawing diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..00868ee --- /dev/null +++ b/environment.yml @@ -0,0 +1,27 @@ +############################################################################### +# +# Software to be installed in the environment +# +# AUTHOR: Maciek_Bak +# AFFILIATION: Department_of_Mathematics_City_University_of_London +# CONTACT: wsciekly.maciek@gmail.com +# CREATED: 01-08-2023 +# LICENSE: Apache 2.0 +# +############################################################################### +--- + + name: hypercomplex-dev + + channels: + - conda-forge + + dependencies: + - compilers=1.6.0 + - cpplint=1.6.0 + - doxygen=1.9.7 + - make=4.3 + - mpfr=4.2.0 + - pre-commit=3.2.1 + +...