From 4143220c498d385adb5a018fb1270062c6a25dc1 Mon Sep 17 00:00:00 2001 From: c-bata Date: Fri, 16 Aug 2024 16:51:46 +0900 Subject: [PATCH] Fix github release action --- .github/workflows/gh-pages.yml | 2 +- .github/workflows/github-release.yml | 12 +++--------- .github/workflows/pypi-publish.yml | 13 +++---------- .github/workflows/python-tests.yml | 19 ++++++++++++++++++- Makefile | 21 +++++++++------------ 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 93c68a3a..0aa43bd8 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 with: - node-version: '18' + node-version: '20' - name: Build rustlib working-directory: rustlib run: wasm-pack build --target web diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index f183fe4e..28694719 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -16,22 +16,16 @@ jobs: uses: actions/setup-node@v2 with: node-version: '20' - - - name: Build bundle.js - working-directory: optuna_dashboard - run: | - npm install - npm run build:prd - - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip setuptools pip install --progress-bar off wheel twine build - - run: python -m build --sdist --wheel + + - run: make python-package - run: twine check dist/* - name: Create GitHub release diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 2b0670bd..0c5faf81 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -13,27 +13,20 @@ jobs: id-token: write steps: - uses: actions/checkout@v2 - - name: Setup Node uses: actions/setup-node@v2 with: node-version: '20' - - - name: Build bundle.js - working-directory: optuna_dashboard - run: | - npm install - npm run build:prd - - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip setuptools pip install --progress-bar off wheel twine build - - run: python -m build --sdist --wheel + + - run: make python-package - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 1c294b33..32bf1a4a 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' architecture: x64 - name: Install dependencies run: | @@ -26,6 +26,23 @@ jobs: - run: black --check --diff . - run: isort --check --diff . - run: mypy optuna_dashboard python_tests + build-python-package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '20' + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install --progress-bar off wheel twine build + - run: make python-package test: runs-on: ubuntu-latest strategy: diff --git a/Makefile b/Makefile index 78be643b..06dbad49 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.DEFAULT_GOAL := sdist +.DEFAULT_GOAL := python-package PYTHON ?= python3 MODE ?= dev @@ -15,7 +15,7 @@ $(RUSTLIB_OUT): rustlib/src/*.rs rustlib/Cargo.toml vscode/assets/bundle.js: $(RUSTLIB_OUT) $(STANDALONE_SRC) tslib cd standalone_app && npm install && npm run build:vscode -$(DASHBOARD_TS_OUT): $(DASHBOARD_TS_SRC) +$(DASHBOARD_TS_OUT): $(DASHBOARD_TS_SRC) tslib cd optuna_dashboard && npm install && npm run build:$(MODE) .PHONY: tslib @@ -31,24 +31,21 @@ tslib-test: tslib .PHONY: serve-browser-app serve-browser-app: tslib $(RUSTLIB_OUT) - cd standalone_app && npm install && npm run watch + cd standalone_app && npm i && npm run watch .PHONY: vscode-extension vscode-extension: vscode/assets/bundle.js - cd vscode && npm install && npm run vscode:prepublish && vsce package + cd vscode && npm i && npm run vscode:prepublish && vsce package .PHONY: jupyterlab-extension jupyterlab-extension: tslib cd optuna_dashboard && npm install && npm run build:pkg cd jupyterlab && python -m build --sdist -.PHONY: sdist -sdist: pyproject.toml $(DASHBOARD_TS_OUT) - python -m build --sdist - -.PHONY: wheel -wheel: pyproject.toml $(DASHBOARD_TS_OUT) - python -m build --wheel +.PHONY: python-package +python-package: pyproject.toml tslib + cd optuna_dashboard && npm i && npm run build:prd + python -m build --sdist --wheel .PHONY: docs docs: docs/conf.py $(RST_FILES) @@ -64,4 +61,4 @@ fmt: clean: rm -rf tslib/types/pkg tslib/storage/pkg tslib/react/pkg tslib/react/types rm -rf optuna_dashboard/public/ doc/_build/ - rm -rf rustlib/pkg standalone_app/public/ vscode/assets/ vscode/*.vsix + rm -rf rustlib/pkg vscode/assets/ vscode/*.vsix