Skip to content

Merge pull request #49 from Kaz205/docker-fix #116

Merge pull request #49 from Kaz205/docker-fix

Merge pull request #49 from Kaz205/docker-fix #116

name: Build Installer
# installer/ 以下のファイルに変更があったとき or
# .github/workflows/build_installer.yaml (このファイル) に変更があったとき or 他のワークフローからの呼び出し or 手動実行
on:
push:
branches:
- master
paths:
- 'installer/**'
- '.github/workflows/build_installer.yaml'
workflow_call:
workflow_dispatch:
# ジョブの定義
jobs:
# Windows 向けのインストーラーのビルド
build-windows:
runs-on: windows-2022
steps:
# KonomiTV のソースコードをチェックアウト
- name: Checkout Repository
uses: actions/checkout@v3
# Python 3.11 環境をセットアップ
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: '${{ github.workspace }}/installer/Pipfile.lock'
# インストーラーの依存関係をインストール
- name: Install Dependencies
working-directory: installer/
run: |
pip install pipenv
pipenv sync
pipenv run pip install https://github.com/tsukumijima/Pyinstaller-Builds/raw/gh-pages/x86_64/pyinstaller-5.10.1-py3-none-any.whl
# インストーラーを PyInstaller でビルド
- name: Build Installer with PyInstaller
working-directory: installer/
run: pipenv run build-windows
# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
- name: Upload Installer Executable as Artifact
uses: actions/upload-artifact@v3
with:
name: KonomiTV-Installer.exe
path: installer/dist/KonomiTV-Installer.exe
# Linux 向けのインストーラーのビルド
build-linux:
runs-on: ubuntu-20.04
steps:
# KonomiTV のソースコードをチェックアウト
- name: Checkout Repository
uses: actions/checkout@v3
# Python 3.11 環境をセットアップ
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: '${{ github.workspace }}/installer/Pipfile.lock'
# インストーラーの依存関係をインストール
- name: Install Dependencies
working-directory: installer/
run: |
pip install pipenv
pipenv sync
# インストーラーを PyInstaller でビルド
- name: Build Installer with PyInstaller
working-directory: installer/
run: pipenv run build-linux
# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
- name: Upload Installer Executable as Artifact
uses: actions/upload-artifact@v3
with:
name: KonomiTV-Installer.elf
path: installer/dist/KonomiTV-Installer.elf
# Linux (ARM) 向けのインストーラーのビルド
build-linux-arm:
runs-on: ubuntu-20.04
strategy:
matrix:
image:
- arm64v8/ubuntu
steps:
# QEMU のセットアップ
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/arm64
# Docker Buildx のセットアップ
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Dockerfile の作成
- name: Create Dockerfile
run: |
cat <<EOF > Dockerfile
ARG IMAGE
FROM \${IMAGE}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get install -y \
build-essential \
curl \
patchelf \
python3.11 \
python3.11-dev \
python3.11-distutils \
python3.11-venv \
zlib1g \
zlib1g-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.11
RUN python3.11 -m pip install pipenv
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
load: true
# Dockerfile を削除
- name: Remove Dockerfile
run: rm Dockerfile
# KonomiTV のソースコードをチェックアウト
- name: Checkout Repository
uses: actions/checkout@v3
# インストーラーを PyInstaller でビルド
- 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'
sudo cp -a dist/KonomiTV-Installer.elf dist/KonomiTV-Installer-ARM.elf
# 単一実行ファイルにビルドされたインストーラーを Artifact としてアップロード
- name: Upload Installer Executable as Artifact
uses: actions/upload-artifact@v3
with:
name: KonomiTV-Installer-ARM.elf
path: installer/dist/KonomiTV-Installer-ARM.elf