Skip to content

Commit

Permalink
Pulling in action definitions
Browse files Browse the repository at this point in the history
justinb4003 committed Jan 24, 2025

Verified

This commit was signed with the committer’s verified signature.
vzaliva Vadim Zaliva
1 parent 815c036 commit 349df9d
Showing 3 changed files with 221 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/pyinstaller-linux-amd64-release-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Linux amd64 Release Build - Azure Enabled

on:
push:
branches:
- release-azure

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11' # Specify the Python version you need

- name: Install wx
run: pip install https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/wxPython-4.2.1-cp311-cp311-linux_x86_64.whl

- name: Install dependencies
run: pip install -r requirements.txt

- name: Install PyInstaller
run: pip install pyinstaller

- name: Build Executable
run: pyinstaller --clean main.spec --distpath ./dist/linux_amd64/

- name: Move in support data files for runtime
run: cp unknown_badge.png dist/linux_amd64/

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: tritime-linux-amd64
path: dist/linux_amd64/

- name: Cache Build Output
uses: actions/cache@v3
with:
path: ./dist/linux_amd64/
key: linux-amd64-app-build-azure-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true

138 changes: 138 additions & 0 deletions .github/workflows/pyinstaller-release-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Create Release - Azure Enabled

on:
push:
branches: [ azure-release ]
pull_request:
branches: [ azure-release ]

jobs:
release:
env:
GH_TOKEN: ${{ github.token }}
runs-on: ubuntu-latest # You can specify other OS like windows-latest if needed
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get the latest tag
id: get_tag
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag: $latest_tag"
# Extract version number (assuming tags follow semantic versioning)
if [ -z "$latest_tag" ]; then
echo "::set-output name=new_tag::v1.0.0"
else
major=$(echo $latest_tag | cut -d. -f1 | sed 's/v//')
minor=$(echo $latest_tag | cut -d. -f2)
patch=$(echo $latest_tag | cut -d. -f3)
new_patch=$((patch + 1))
new_tag="v$major.$minor.$new_patch"
echo "::set-output name=new_tag::$new_tag"
fi
shell: bash

- name: Wait for Caches to Appear
id: wait-for-cache
run: |
max_attempts=40 # Maximum number of attempts
attempt=1
success=false
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt: Checking for all caches..."
# Check for all caches
windows_cache=$(gh cache list --json key --jq ".[] | select(.key == \"windows-app-build-${{ github.ref_name }}-${{ github.sha }}\")")
linux_cache=$(gh cache list --json key --jq ".[] | select(.key == \"linux-amd64-app-build-${{ github.ref_name }}-${{ github.sha }}\")")
if [ -n "$windows_cache" ]; then
echo "Windows cache found."
fi
if [ -n "$linux_cache" ]; then
echo "Linux amd64 cache found."
fi
if [ -n "$windows_cache" ] && [ -n "$linux_cache" ]; then
echo "All caches found! Proceeding with build."
success=true
break
else
echo "One or more caches not found. Retrying in 30 seconds..."
sleep 30
fi
attempt=$(( attempt + 1 ))
done
if [ "$success" = false ]; then
echo "Caches not available after $max_attempts attempts. Exiting..."
exit 1
fi
- name: Restore Windows x64 From Cache
uses: actions/cache@v3
with:
path: ./dist/windows/
key: windows-app-build-azure-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Restore Linux amd64 From Cache
uses: actions/cache@v3
with:
path: ./dist/linux_amd64/
key: linux-amd64-app-build-azure-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Verify Restored Binaries
run: |
echo "Listing files in ./:"
ls -l ./
ls -l ./dist/linux_amd64/
ls -l ./dist/windows/
- name: Create Windows ZIP archive
run: |
zip -jr ./tritime-win64.zip ./dist/windows/
- name: Create Linux amd64 archive
run: |
cd dist/linux_amd64/ && tar -czvf ../../tritime-linux-amd64.tar.gz ./
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag.outputs.new_tag }}
release_name: Tritime (Azure) ${{ steps.get_tag.outputs.new_tag }}
draft: false
prerelease: false

- name: Upload Windows Artifact to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tritime-win64.zip
asset_name: tritime-win64.zip
asset_content_type: application/zip

- name: Upload Linux amd64 Artifact to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tritime-linux-amd64.tar.gz
asset_name: tritime-linux-amd64.tar.gz
asset_content_type: application/tgz

35 changes: 35 additions & 0 deletions .github/workflows/pyinstaller-win64-release-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Windows x64 Release Build

on:
push:
branches: [ azure-release ]
pull_request:
branches: [ azure-release ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Package Application
uses: JackMcKew/pyinstaller-action-windows@main
with:
path: ./

- name: Move in support data files for runtime
run: cp unknown_badge.png dist/windows/

- uses: actions/upload-artifact@v4
with:
name: tritime-win64
path: ./dist/windows

- name: Cache Build Output
uses: actions/cache@v3
with:
path: ./dist/windows/
key: windows-app-build-azure-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true

0 comments on commit 349df9d

Please sign in to comment.