diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index 13ad9d9b..2dd12292 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -4,7 +4,7 @@ on: [push] jobs: doc_ubuntu: - name: Build documentation on Ubuntu + name: Build documentation runs-on: ubuntu-latest steps: - name: Checkout sources @@ -20,6 +20,6 @@ jobs: python -m pip install --upgrade pip pip3 install .[docs] - - name: Build doc + - name: Build documentation run: | sphinx-build -a docs ./build-docs \ No newline at end of file diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 00000000..e8284eda --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,109 @@ +name: CI/CD + +on: + push: + branches: + - main + - github-actions-test + paths: + - '**.py' + - '.github/workflows/lint.yml' + pull_request: + branches: + - main + paths: + - '**.py' + - '.github/workflows/lint.yml' + types: + - opened + - synchronize + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + name: Code Style Check ๐ŸŽจ + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Install dependencies [pip] + run: | + python -m pip install --upgrade pip + pip install black isort + + - name : Check Black + run: | + black . --check + + - name : Check Isort + run: | + isort --profile black --check . + + test: + needs: lint + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-latest, windows-latest, macos-latest] + + name: Run tests on ${{ matrix.os }} for Python ${{ matrix.python-version }} ๐Ÿงช + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package [pip] + run: | + python -m pip install --upgrade pip + pip install .[test] + + - name: Run tests with Pytest + run: | + python -m coverage run -m pytest + + - name: Coverage + if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' }} + run: | + python -m coverage report + python -m coverage json + + - name: Upload coverage artifact + if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' }} + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage.json + + - name: Metadata check + if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' }} + run: | + python .github/scripts/metadata_checker + + upload-coverage: + runs-on: ubuntu-latest + needs: test + name: Upload coverage report to Codecov ๐Ÿ“Š + steps: + - name: Download coverage report + uses: actions/download-artifact@v4 + with: + name: coverage-report + + - name: Upload to Codecov + uses: codecov/codecov-action@v4 + with: + files: coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 0ccc8186..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: "Lint" - -on: - push: - branches: - - main - - github-actions-test - paths: - - '**.py' - - '.github/workflows/lint.yml' - pull_request: - branches: - - main - paths: - - '**.py' - - '.github/workflows/lint.yml' - types: - - opened - - synchronize - workflow_dispatch: - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - name: install dependencies [pip] - run: | - python -m pip install --upgrade pip - pip install black isort - - - name : Check Black - run: | - black . --check - - - name : Check isort - run: | - isort --profile black --check . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 278dfbf8..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: "Testing" - -on: - push: - branches: - - main - pull_request: - branches: - - main - types: - - opened - - synchronize - workflow_run: - workflows: ["lint"] - types: - - completed - workflow_dispatch: - -jobs: - test: - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - os: [ubuntu-latest, windows-latest, macos-latest] - - name: Install and test package on ${{ matrix.os }} for Python ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install package [pip] - run: | - python -m pip install --upgrade pip - pip install .[test] - - - name: Run tests with Pytest - run: | - coverage run -m pytest - - - name: Coverage - run: | - coverage report - coverage json - - - name: Metadata check - if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' }} - run: | - python .github/scripts/metadata_checker - - - name: Upload coverage to Codecov - if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' }} - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/requirements.txt b/requirements.txt index ee072cea..bb2d8682 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,39 +1,13 @@ black==24.3.0 -click==8.1.6 -colorama==0.4.6 coverage==7.2.7 -exceptiongroup==1.1.2 -filelock==3.12.2 flake8==6.1.0 -iniconfig==2.0.0 +furo isort==5.12.0 -Jinja2==3.1.6 -MarkupSafe==2.1.3 -mccabe==0.7.0 -mpmath==1.3.0 -mypy-extensions==1.0.0 -networkx==3.1 -numpy==1.25.2 +myst-parser +numpy==1.26.4 numpydoc==1.6.0 -packaging==23.1 -pathspec==0.11.2 -platformdirs==3.10.0 -pluggy==1.2.0 -pycodestyle==2.11.0 -pyflakes==3.1.0 pytest==7.4.0 -readthedocs-sphinx-search==0.3.2 sphinx==7.1.2 -sphinx-rtd-theme==1.3.0 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.1 -sphinxcontrib-jquery==4.1 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 sympy==1.12 -tomli==2.0.1 torch==2.2.0 -tqdm==4.66.3 -typing_extensions==4.7.1 \ No newline at end of file +tqdm==4.66.3 \ No newline at end of file