Skip to content

Commit

Permalink
Refactor: [Installer] インストーラーのパッケージマネージャーを pipenv から poetry に移行
Browse files Browse the repository at this point in the history
pipenv の lock 速度が poetry との比較であまりに遅すぎるため
poetry はタスクランナーがデフォルトで用意されていない問題こそあるものの、全体的には pipenv より明確で優れている
  • Loading branch information
tsukumijima committed Sep 21, 2023
1 parent b478fd1 commit 288aa11
Show file tree
Hide file tree
Showing 7 changed files with 1,309 additions and 896 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/build_installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: '${{ github.workspace }}/installer/Pipfile.lock'
cache: 'poetry'

# インストーラーの依存関係をインストール
- name: Install Dependencies
working-directory: installer/
run: |
pip install pipenv
pipenv sync
pip install poetry
poetry install
# ウイルス検知対策で Windows のみ自前ビルドの PyInstaller に差し替える
pipenv run pip install https://github.com/tsukumijima/Pyinstaller-Builds/raw/gh-pages/x86_64/pyinstaller-5.13.0-py3-none-any.whl
poetry run pip install https://github.com/tsukumijima/Pyinstaller-Builds/raw/gh-pages/x86_64/pyinstaller-5.13.0-py3-none-any.whl
# インストーラーを PyInstaller でビルド
- name: Build Installer with PyInstaller
working-directory: installer/
run: pipenv run build-windows
run: poetry run task build-windows

# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
- name: Upload Installer Executable as Artifact
Expand All @@ -68,20 +67,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: '${{ github.workspace }}/installer/Pipfile.lock'
cache: 'poetry'

# インストーラーの依存関係をインストール
- name: Install Dependencies
working-directory: installer/
run: |
pip install pipenv
pipenv sync
pip install poetry
poetry install
# インストーラーを PyInstaller でビルド
- name: Build Installer with PyInstaller
working-directory: installer/
run: pipenv run build-linux
run: poetry run task build-linux

# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
- name: Upload Installer Executable as Artifact
Expand All @@ -93,10 +91,6 @@ jobs:
# Linux (ARM) 向けのインストーラーのビルド
build-linux-arm:
runs-on: ubuntu-20.04
strategy:
matrix:
image:
- arm64v8/ubuntu
steps:

# QEMU のセットアップ
Expand Down Expand Up @@ -130,18 +124,18 @@ jobs:
zlib1g \
zlib1g-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.11
RUN python3.11 -m pip install pipenv
RUN python3.11 -m pip install poetry
EOF
# ARM64 版 Docker イメージのビルド
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
tags: ${{ matrix.image }}:build
build-args: IMAGE=${{ matrix.image }}:20.04
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,scope=${{ matrix.image }},mode=max
tags: arm64v8/ubuntu:build
build-args: IMAGE=arm64v8/ubuntu:20.04
cache-from: type=gha,scope=arm64v8/ubuntu
cache-to: type=gha,scope=arm64v8/ubuntu,mode=max
load: true

# Dockerfile を削除
Expand All @@ -156,8 +150,8 @@ jobs:
- name: Build Installer with PyInstaller
working-directory: installer/
run: |
docker run --rm -i -v $(pwd):/work -w /work ${{ matrix.image }}:build bash -c \
'PIPENV_VENV_IN_PROJECT=true pipenv sync && pipenv run build-linux'
docker run --rm -i -v $(pwd):/work -w /work arm64v8/ubuntu:build bash -c \
'poetry install && poetry run task build-linux'
sudo cp -a dist/KonomiTV-Installer.elf dist/KonomiTV-Installer-ARM.elf
# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/create_release_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
# ソースコードやドキュメント内のバージョンを更新
sed -i -e 's|"version": ".*",|"version": "${{ github.event.inputs.version }}",|' client/package.json
sed -i -e 's|version = ".*"|version = "${{ github.event.inputs.version }}"|' installer/pyproject.toml
sed -i -e "s|TARGET_VERSION = '.*'|TARGET_VERSION = '${{ github.event.inputs.version }}'|" installer/KonomiTV-Installer.py
sed -i -e "s|VERSION = '.*'|VERSION = '${{ github.event.inputs.version }}'|" server/app/constants.py
sed -i -e 's|download/v.*/thirdparty-linux\.tar\.xz|download/v${{ github.event.inputs.version }}/thirdparty-linux\.tar\.xz|' Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends aria2 ca-certif
WORKDIR /
# RUN aria2c -x10 https://github.com/tsukumijima/KonomiTV/releases/download/v0.7.1/thirdparty-linux.tar.xz
# RUN tar xvf thirdparty-linux.tar.xz
RUN aria2c -x10 https://nightly.link/tsukumijima/KonomiTV/actions/runs/5518921550/thirdparty-linux.tar.xz.zip
RUN aria2c -x10 https://nightly.link/tsukumijima/KonomiTV/workflows/build_thirdparty.yaml/master/thirdparty-linux.tar.xz.zip
RUN unzip thirdparty-linux.tar.xz.zip && tar xvf thirdparty-linux.tar.xz

# --------------------------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 288aa11

Please sign in to comment.