From c52caa38ca5f30ea45329170eb0be985c276b0a5 Mon Sep 17 00:00:00 2001 From: Hippalectryon <6502864+hippalectryon-0@users.noreply.github.com> Date: Fri, 20 Oct 2023 18:13:36 +0200 Subject: [PATCH] Add CI (#2) --- .github/workflows/main.yml | 71 ++++++++++++++++++++++++++++++++++++++ .gitignore | 2 +- README.md | 2 +- readthedocs.yaml | 2 +- update.ps1 | 2 +- updating.md | 2 +- 6 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9849722 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,71 @@ +name: CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: setup + run: | + cp log-grid/.pre-commit-config.yaml . + cp log-grid/pyproject.toml . + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + + build: + runs-on: ubuntu-latest + container: + image: tempuser8755/python3.11-clang15-omp:latest + strategy: + matrix: + python-version: [ '3.11' ] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: 'x64' + + - name: Install Poetry & venv + run: | + python3.11 -m pip install poetry + python3.11 -m virtualenv .venv + . .venv/bin/activate + + - name: Install dependencies + run: | + . .venv/bin/activate + cd log-grid + poetry install + pip uninstall -y pyloggrid # remove from site-packages, use local source instead (instead we get wrong coverage) + + - name: Compile + run: | + . .venv/bin/activate + cd log-grid + cd pyloggrid/LogGrid + make + + - name: Run Flake8 + run: | + . .venv/bin/activate + cd log-grid + flake8 . --count --ignore=E203,E266,E402,E501,E731,E741,W503 --show-source --statistics --exclude=.venv,Archive,Examples/Draft + + - name: Run Tests + run: | + . .venv/bin/activate + cd log-grid + python -m pytest -v --junitxml=report.xml --cov=. --cov-report xml:coverage.xml --cov-report term diff --git a/.gitignore b/.gitignore index 8f19b19..b92a005 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ log-grid/* !log-grid/Simulations/ !log-grid/.gitlab !log-grid/readme_pypi.md -!log-grid/build.py \ No newline at end of file +!log-grid/build.py diff --git a/README.md b/README.md index 0804730..7a7530d 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,4 @@ This repository is used to open-source the code and documentation, and allow iss **The code of interest if located in log-grid/. The files in the root directory are only used to link the Gitlab and Github, and build documentation.** -*Since this is not the main repository, and requires syncing by hand, it may not always be up to date with the latest version. If you think this repository is missing a version, don't hesitate to open an issue.* \ No newline at end of file +*Since this is not the main repository, and requires syncing by hand, it may not always be up to date with the latest version. If you think this repository is missing a version, don't hesitate to open an issue.* diff --git a/readthedocs.yaml b/readthedocs.yaml index 89b0588..ee634a5 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -10,4 +10,4 @@ build: - cd log-grid && poetry config virtualenvs.create false - cd log-grid && poetry install --with=docs sphinx: - configuration: log-grid/docs/conf.py \ No newline at end of file + configuration: log-grid/docs/conf.py diff --git a/update.ps1 b/update.ps1 index 1c6352f..681875f 100644 --- a/update.ps1 +++ b/update.ps1 @@ -4,4 +4,4 @@ Remove-Item -Path .\log-grid -Recurse -ErrorAction SilentlyContinue git clone https://drf-gitlab.cea.fr/amaury.barral/log-grid.git -b 2.2.0 # Change the tag accordingly cd log-grid Remove-Item -Recurse -Force .git -Set-Location ../ \ No newline at end of file +Set-Location ../ diff --git a/updating.md b/updating.md index 6bd2f8e..64b6998 100644 --- a/updating.md +++ b/updating.md @@ -2,4 +2,4 @@ - `rm -rf log-grid` - `git clone https://drf-gitlab.cea.fr/amaury.barral/log-grid.git` -- `rm -rf log-grid/.git` \ No newline at end of file +- `rm -rf log-grid/.git`