From 7c654ef47f4c6c0abbec881a3645a1f608b2ccc2 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Sun, 3 Sep 2023 22:35:00 +0000 Subject: [PATCH] =?UTF-8?q?Add:=20GitHub=20Actions=20=E3=81=A7=E3=83=93?= =?UTF-8?q?=E3=83=AB=E3=83=89=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 3 ++ .github/workflows/build.yml | 100 ++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.editorconfig b/.editorconfig index adb6edc..bbc8a70 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,6 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7dc19ba --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,100 @@ + +name: Build + +on: + push: + workflow_call: + workflow_dispatch: + +jobs: + + build-linux: + runs-on: ubuntu-20.04 + steps: + + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'poetry' + cache-dependency-path: '${{ github.workspace }}/poetry.lock' + + - name: Install Dependencies + run: | + pip install nuitka poetry + poetry install + + - name: Build Installer with Nuitka + run: | + nuitka --onefile --follow-imports --assume-yes-for-downloads --output-filename=isdb-scanner isdb_scanner/__main__.py + + - name: Upload Installer Executable as Artifact + uses: actions/upload-artifact@v3 + with: + name: isdb-scanner + path: dist/isdb-scanner + + build-linux-arm: + runs-on: ubuntu-20.04 + steps: + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Create Dockerfile + run: | + cat < Dockerfile + FROM arm64v8/ubuntu:20.04 + 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 nuitka poetry + EOF + + - name: Build Docker Image + uses: docker/build-push-action@v3 + with: + context: . + tags: arm64v8/ubuntu:build + cache-from: type=gha,scope=arm64v8/ubuntu + cache-to: type=gha,scope=arm64v8/ubuntu,mode=max + load: true + + - name: Remove Dockerfile + run: rm Dockerfile + + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Build Installer with Nuitka + run: | + docker run --rm -i -v $(pwd):/work -w /work arm64v8/ubuntu:build bash -c \ + 'poetry install && \ + nuitka --onefile --follow-imports --assume-yes-for-downloads --output-filename=isdb-scanner isdb_scanner/__main__.py' + sudo cp -a dist/isdb-scanner dist/isdb-scanner-arm + + - name: Upload Installer Executable as Artifact + uses: actions/upload-artifact@v3 + with: + name: isdb-scanner-arm + path: dist/isdb-scanner-arm