From ad4f82675836fb113d60a2d088709634cad0f8db Mon Sep 17 00:00:00 2001 From: Yuchen Jin Date: Sat, 14 Sep 2024 06:28:34 +0000 Subject: [PATCH] 0.3.1 - adjust workflows Adjust the format of the workflow files. --- .github/workflows/python-package.yml | 83 ++++++++++++++-------------- .github/workflows/python-publish.yml | 63 ++++++++++----------- Changelog.md | 1 + 3 files changed, 74 insertions(+), 73 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fd1b830..c21b4b4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,13 +5,12 @@ name: Python package on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false @@ -19,42 +18,42 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v4 - - name: Set up Chrome - uses: browser-actions/setup-chrome@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - cache: 'npm' - - name: Enable Corepack - run: | - npm install -g corepack - corepack enable - - name: Yarn run install - uses: borales/actions-yarn@v4 - with: - cmd: install - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest wheel - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi - - name: Use Yarn to build component - uses: borales/actions-yarn@v4 - with: - cmd: build - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --ignore=E203,E501,W503,E701,E704 --statistics - - name: Test with pytest - run: | - python -m pytest --headless --with-dash + - uses: actions/checkout@v4 + - name: Set up Chrome + uses: browser-actions/setup-chrome@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: "npm" + - name: Enable Corepack + run: | + npm install -g corepack + corepack enable + - name: Yarn run install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest wheel + if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi + if [ -f tests/requirements.txt ]; then python -m pip install -r tests/requirements.txt; fi + - name: Use Yarn to build component + uses: borales/actions-yarn@v4 + with: + cmd: build + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --ignore=E203,E501,W503,E701,E704 --statistics + - name: Test with pytest + run: | + python -m pytest --headless --with-dash diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 41a88f6..d250cfe 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -26,34 +26,35 @@ jobs: id-token: write steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Set up Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - cache: 'npm' - - name: Enable Corepack - run: | - npm install -g corepack - corepack enable - - name: Yarn run install - uses: borales/actions-yarn@v4 - with: - cmd: install - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build wheel - if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi - - name: Use Yarn to build component - uses: borales/actions-yarn@v4 - with: - cmd: build - - name: Build package - run: python -m build - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Set up Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: "npm" + - name: Enable Corepack + run: | + npm install -g corepack + corepack enable + - name: Yarn run install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build wheel + if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi + if [ -f requirements-dev.txt ]; then python -m pip install -r requirements-dev.txt; fi + - name: Use Yarn to build component + uses: borales/actions-yarn@v4 + with: + cmd: build + - name: Build package + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Changelog.md b/Changelog.md index be07051..f801989 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ 2. Adjust project details in the readme. 3. Add an explanation about `data` in the readme. 4. Adjust the metadata of the project, and remove the auto-genreated file. +5. Adjust the format of the workflow files. ### 0.3.0 @ 09/13/2024