From daa93c1a83c22b2780ca9dc0d84dc70a6a2969dc Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 7 Aug 2023 16:46:30 +0800 Subject: [PATCH 1/4] feat(CI): move to github --- .flake8 | 3 +- .github/workflows/check-pre-commit.yml | 14 +++ .github/workflows/release.yml | 38 ++++++++ .github/workflows/test-esp-docs.yml | 128 +++++++++++++++++++++++++ .pre-commit-config.yaml | 12 +++ pyproject.toml | 53 +++++++++- src/esp_docs/__init__.py | 0 src/esp_docs/__version__.py | 3 + 8 files changed, 245 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/check-pre-commit.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test-esp-docs.yml create mode 100644 .pre-commit-config.yaml delete mode 100644 src/esp_docs/__init__.py create mode 100644 src/esp_docs/__version__.py diff --git a/.flake8 b/.flake8 index cbf6ff2..c02c50b 100644 --- a/.flake8 +++ b/.flake8 @@ -1,8 +1,7 @@ [flake8] -exclude = citools/ max-line-length = 160 per-file-ignores = # conf.py files use star imports to setup config variables examples/*/conf*.py: F405 docs/conf*.py: F405 - test/*/conf*py: F405 \ No newline at end of file + test/*/conf*py: F405 diff --git a/.github/workflows/check-pre-commit.yml b/.github/workflows/check-pre-commit.yml new file mode 100644 index 0000000..6111ee5 --- /dev/null +++ b/.github/workflows/check-pre-commit.yml @@ -0,0 +1,14 @@ +name: pre-commit check + +on: + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..141c491 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release New Version + +on: + push: + tags: + - 'v*' + +env: + RELEASE_VERSION: '' + RELEASE_NOTES_BODY_FILE: 'body.md' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.7' + - name: Publish packages + env: + FLIT_USERNAME: __token__ + FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: + echo "{env.RELEASE_NOTE_VERSION}={$(git describe --tags)}" >> "$GITHUB_ENV" + # pip install flit + # flit publish + - name: Create Release Notes + run: + echo "Changelog for release ${env.RELEASE_NOTE_VERSION}:" + cz changelog --file-name ${env.RELEASE_NOTES_BODY_FILE} ${env.RELEASE_NOTE_VERSION} + cat ${env.RELEASE_NOTES_BODY_FILE} + - name: Create Github Release + uses: softprops/action-gh-release@v1 + with: + body_path: ${{ env.RELEASE_NOTES_BODY_FILE }} + tag_name: ${{ env.RELEASE_NOTE_VERSION }} diff --git a/.github/workflows/test-esp-docs.yml b/.github/workflows/test-esp-docs.yml new file mode 100644 index 0000000..9f5db2a --- /dev/null +++ b/.github/workflows/test-esp-docs.yml @@ -0,0 +1,128 @@ +# name: Test Esp-Docs + +# on: +# pull_request: +# push: +# branches: +# - main + +# defaults: +# run: +# shell: bash + +# jobs: +# build-python-packages: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-python@v4 +# with: +# python-version: '3.7' +# - run: | +# pip install -U pip +# pip install flit +# flit build +# - name: Upload built python packages +# uses: actions/upload-artifact@v3 +# with: +# name: wheel +# path: dist/esp_docs-*-py3-none-any.whl + + # test-esp-docs-ut: + # runs-on: ubuntu-latest + # needs: build-python-packages + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.7' + # - name: Download wheel + # uses: actions/download-artifact@v3 + # with: + # name: wheel + # - run: | + # pip install -U pip + # pip install esp_docs-*-py3-none-any.whl + # cd test/unit_tests + # python test_docs.py + # python test_esp_extensions.py + # python test_deploy.py + + # test-esp-docs-build: + # runs-on: ubuntu-latest + # needs: build-python-packages + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.7' + # - name: Download wheel + # uses: actions/download-artifact@v3 + # with: + # name: wheel + # - run: | + # pip install -U pip + # pip install esp_docs-*-py3-none-any.whl + # sudo apt update && sudo apt install -y doxygen latexmk texlive-latex-recommended texlive-fonts-recommended texlive-xetex fonts-freefont-otf + # cd test/build_tests + # ./build_all.sh + + # build-esp-docs-examples-basic: + # runs-on: ubuntu-latest + # needs: build-python-packages + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.7' + # - name: Download wheel + # uses: actions/download-artifact@v3 + # with: + # name: wheel + # - run: | + # pip install -U pip + # pip install esp_docs-*-py3-none-any.whl + # cd examples/basic + # ./build_example.sh + + # build-esp-docs-examples-doxygen: + # runs-on: ubuntu-latest + # needs: build-python-packages + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.7' + # - name: Download wheel + # uses: actions/download-artifact@v3 + # with: + # name: wheel + # - run: | + # pip install -U pip + # pip install esp_docs-*-py3-none-any.whl + # sudo apt update && sudo apt install -y doxygen + # cd examples/doxygen + # ./build_example.sh + + # build-esp-idf-docs: + # runs-on: ubuntu-latest + # needs: build-python-packages + # container: espressif/idf:v5.1 + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.7' + # - name: Download wheel + # uses: actions/download-artifact@v3 + # with: + # name: wheel + # - name: Build docs for esp-idf + # shell: bash + # run: | + # ${IDF_PATH}/install.sh + # . ${IDF_PATH}/export.sh + # apt update && apt install -y libffi-dev libcairo2-dev doxygen + # pip install esp_docs-*-py3-none-any.whl + # cd ${IDF_PATH}/docs + # build-docs -t esp32 -l en \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..adcd033 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +repos: + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + args: ['--config=.flake8'] + - repo: https://github.com/commitizen-tools/commitizen + rev: 3.6.0 + hooks: + - id: commitizen + - id: commitizen-branch + stages: [push] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 374b58c..0e59717 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,51 @@ [build-system] -requires = [ - "setuptools>=42", - "wheel" +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "esp_docs" +authors = [{name = "Espressif", email = "marius.vikhammer@espressif.com"}] +readme = "README.md" +license = {file = "LICENSE"} +classifiers = ["License :: OSI Approved :: MIT License"] + +dynamic = ["version", "description"] +requires-python = ">=3.7" + +dependencies = [ + "docutils<0.18", + "pillow<10.0.0", + "cairosvg==2.5.1", # required by sphinxcontrib-svg2pdfconverter[CairoSVG] + "sphinx==4.5.0", + "breathe==4.33.1", + "sphinx-copybutton==0.5.0", + "sphinx-notfound-page", + "sphinxcontrib-blockdiag==3.0.0", + "sphinxcontrib-seqdiag==3.0.0", + "sphinxcontrib-actdiag==3.0.0", + "sphinxcontrib-nwdiag==2.0.0", + "sphinxcontrib-wavedrom>=3.0,<3.1", + "sphinxcontrib-svg2pdfconverter[CairoSVG]==1.2.0", + "nwdiag==2.0.0", + "recommonmark", + "sphinx_selective_exclude==1.0.3", + "sphinx_idf_theme==1.1.0", ] -build-backend = "setuptools.build_meta" + +[project.urls] +Home = "https://github.com/espressif/esp-docs" + +[project.scripts] +build-docs = "esp_docs.build_docs:main" +deploy-docs = "esp_docs.deploy_docs:main" + + +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "v$version" +version = "1.5.0" +changelog_start_rev = "v1.5.0" +version_files = [ + "src/esp_docs/__version__.py", +] +update_changelog_on_bump = true diff --git a/src/esp_docs/__init__.py b/src/esp_docs/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/esp_docs/__version__.py b/src/esp_docs/__version__.py new file mode 100644 index 0000000..14b3e15 --- /dev/null +++ b/src/esp_docs/__version__.py @@ -0,0 +1,3 @@ +"""Documentation building package used at Espressif""" + +__version__ = "1.5.0" From 4cc571f9d50942feda0fdcaaadc979a2a4311bee Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 7 Aug 2023 16:48:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?bump:=20version=201.5.0=20=E2=86=92=201.6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 +++++ pyproject.toml | 2 +- src/esp_docs/__version__.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..19c1ed5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## v1.6.0 (2023-08-07) + +### Feat + +- **CI**: move to github diff --git a/pyproject.toml b/pyproject.toml index 0e59717..482e693 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ deploy-docs = "esp_docs.deploy_docs:main" [tool.commitizen] name = "cz_conventional_commits" tag_format = "v$version" -version = "1.5.0" +version = "1.6.0" changelog_start_rev = "v1.5.0" version_files = [ "src/esp_docs/__version__.py", diff --git a/src/esp_docs/__version__.py b/src/esp_docs/__version__.py index 14b3e15..afc41e6 100644 --- a/src/esp_docs/__version__.py +++ b/src/esp_docs/__version__.py @@ -1,3 +1,3 @@ """Documentation building package used at Espressif""" -__version__ = "1.5.0" +__version__ = "1.6.0" From 83c1a541bae4107e87c284cd718a3bb408357721 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 7 Aug 2023 16:58:17 +0800 Subject: [PATCH 3/4] ci(release): fix fix --- .github/workflows/release.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 141c491..9194a55 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,12 @@ name: Release New Version +# on: +# push: +# tags: +# - 'v*' + on: - push: - tags: - - 'v*' + pull_request: env: RELEASE_VERSION: '' @@ -28,9 +31,9 @@ jobs: # flit publish - name: Create Release Notes run: - echo "Changelog for release ${env.RELEASE_NOTE_VERSION}:" - cz changelog --file-name ${env.RELEASE_NOTES_BODY_FILE} ${env.RELEASE_NOTE_VERSION} - cat ${env.RELEASE_NOTES_BODY_FILE} + echo "Changelog for release ${RELEASE_NOTE_VERSION}:" + cz changelog --file-name ${RELEASE_NOTES_BODY_FILE} ${RELEASE_NOTE_VERSION} + cat ${RELEASE_NOTES_BODY_FILE} - name: Create Github Release uses: softprops/action-gh-release@v1 with: From bf039a57cd3133a7a747e4e8726c37209d5ffb04 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 7 Aug 2023 16:59:52 +0800 Subject: [PATCH 4/4] ci(release): fix --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9194a55..efea463 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,16 +26,16 @@ jobs: FLIT_USERNAME: __token__ FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: - echo "{env.RELEASE_NOTE_VERSION}={$(git describe --tags)}" >> "$GITHUB_ENV" + echo "{env.RELEASE_VERSION}={$(git describe --tags --abbrev=0)}" >> "$GITHUB_ENV" # pip install flit # flit publish - name: Create Release Notes run: - echo "Changelog for release ${RELEASE_NOTE_VERSION}:" - cz changelog --file-name ${RELEASE_NOTES_BODY_FILE} ${RELEASE_NOTE_VERSION} + echo "Changelog for release ${RELEASE_VERSION}:" + cz changelog --file-name ${RELEASE_NOTES_BODY_FILE} ${RELEASE_VERSION} cat ${RELEASE_NOTES_BODY_FILE} - name: Create Github Release uses: softprops/action-gh-release@v1 with: body_path: ${{ env.RELEASE_NOTES_BODY_FILE }} - tag_name: ${{ env.RELEASE_NOTE_VERSION }} + tag_name: ${{ env.RELEASE_VERSION }}