128-multiple-fixes-and-temp-profile-changes #237
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Build Checks | |
on: | |
pull_request: | |
branches: | |
- master | |
- releases/** | |
defaults: | |
run: | |
shell: bash | |
env: | |
project-name: qBitrr | |
jobs: | |
package: | |
if: github.event.pull_request.draft == false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- '3.10' | |
os: | |
- windows-latest | |
- macOS-latest | |
- ubuntu-latest | |
arch: | |
- x86 | |
- x64 | |
- arm64 | |
exclude: | |
- os: ubuntu-latest | |
arch: x86 | |
- os: ubuntu-latest | |
arch: arm64 | |
- os: macOS-latest | |
arch: x64 | |
- os: macOS-latest | |
arch: x86 | |
- os: windows-latest | |
arch: arm64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python}} | |
architecture: ${{ matrix.arch }} | |
- name: Install APT dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libsdl2-dev | |
- name: Get git hash | |
run: | | |
echo "Current Hash: $(git rev-parse --short HEAD)" | |
echo "HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
id: git_hash | |
- name: Set archive name | |
run: | | |
ARCHIVE_NAME=${{ env.project-name }}-${{ steps.git_hash.outputs.HASH }}-${{ matrix.os }}-${{ matrix.arch }} | |
echo "Archive name set to: $ARCHIVE_NAME" | |
echo "NAME=$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
id: archieve | |
- name: Update git hash | |
run: | | |
sed -i -e 's/git_hash = \".*\"/git_hash = \"${{ steps.git_hash.outputs.HASH }}\"/g' ./qBitrr/bundled_data.py | |
- name: Retrieve current version | |
run: | | |
echo "Current version: $(python setup.py --version)" | |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
id: current_version | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U setuptools==69.5.1 | |
python -m pip install -U wheel | |
python -m pip install -r requirements.dev.txt | |
- name: Run PyInstaller | |
env: | |
PYTHONOPTIMIZE: 1 # Enable optimizations as if the -O flag is given. | |
PYTHONHASHSEED: 42 # Try to ensure deterministic results. | |
PYTHONUNBUFFERED: 1 | |
run: | | |
pyinstaller build.spec | |
# This step exists for debugging. Such as checking if data files were included correctly by PyInstaller. | |
- name: List distribution files | |
run: | | |
find dist | |
# Archive the PyInstaller build using the appropriate tool for the platform. | |
- name: Tar files | |
if: runner.os != 'Windows' | |
run: | | |
tar --format=ustar -czvf ${{ steps.archieve.outputs.NAME }}.tar.gz dist/ | |
- name: Archive files | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Compress-Archive dist/* ${{ steps.archieve.outputs.NAME }}.zip | |
# Upload archives as artifacts, these can be downloaded from the GitHub actions page. | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: automated-build-${{ steps.archieve.outputs.NAME }} | |
path: ${{ steps.archieve.outputs.NAME }}.* | |
if-no-files-found: error | |
docker_image: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- id: string | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
token: ${{ secrets.PAT }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.REG_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
feramance/qbitrr | |
ghcr.io/${{ steps.string.outputs.lowercase }} | |
tags: | | |
type=ref,event=pr | |
- name: Build and push Docker images | |
env: | |
DOCKER_BUILDKIT: 1 | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
docker_image_arm: | |
name: Build ARM Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- id: string | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
token: ${{ secrets.PAT }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.REG_TOKEN }} | |
- name: Extract metadata (tags, labels) for ARM Docker | |
id: meta-arm | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
feramance/qbitrr | |
ghcr.io/${{ steps.string.outputs.lowercase }} | |
tags: | | |
type=ref,event=pr,suffix=-arm | |
- name: Build and push ARM Docker images | |
env: | |
DOCKER_BUILDKIT: 1 | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/arm64 | |
push: true | |
tags: ${{ steps.meta-arm.outputs.tags }} | |
labels: ${{ steps.meta-arm.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |