Skip to content

Commit

Permalink
fix workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
danyworks committed Sep 25, 2024
1 parent 533e783 commit 4d8f81b
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 1 deletion.
110 changes: 110 additions & 0 deletions .github/workflows/build-mac-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: 'Build macOS ARM'

on:
workflow_call:
inputs:
python_version:
description: 'Python version to use'
required: false
default: '3.10'
type: string
chromium_version:
description: 'Ungoogled Chromium version'
required: false
default: '129.0.6668.58-1.1'
type: string
chromedriver_version:
description: 'ChromeDriver version'
required: false
default: '129.0.6668.70'
type: string

env:
CHROMIUM_BASE_URL: 'https://github.com/ungoogled-software/ungoogled-chromium-macos/releases/download'
CHROMEDRIVER_BASE_URL: 'https://storage.googleapis.com/chrome-for-testing-public'
OUTPUT_DIR: 'ungoogled_chromium'

jobs:
build-macos-arm:
name: Bundle Executable (ARM)
runs-on: macos-14
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Install pipenv
run: |
pip install --user pipenv
echo "$HOME/Library/Python/${{ inputs.python_version }}/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
pipenv install --dev
- name: Cache Ungoogled Chromium
id: cache-chromium
uses: actions/cache@v4
with:
path: ${{ env.OUTPUT_DIR }}
key: ${{ runner.os }}-arm-chromium-${{ inputs.chromium_version }}

- name: Download Ungoogled Chromium
if: steps.cache-chromium.outputs.cache-hit != 'true'
run: |
curl -L -o ungoogled-chromium.dmg ${{ env.CHROMIUM_BASE_URL }}/${{ inputs.chromium_version }}/ungoogled-chromium_${{ inputs.chromium_version }}_arm64-macos.dmg
mkdir -p ${{ env.OUTPUT_DIR }}
hdiutil attach ungoogled-chromium.dmg
# Dynamically get the volume name
VOLUME_NAME=$(ls /Volumes | grep -i "Chromium")
cp -R /Volumes/"$VOLUME_NAME"/Chromium.app ${{ env.OUTPUT_DIR }}/
hdiutil detach /Volumes/"$VOLUME_NAME"
ls -la ${{ env.OUTPUT_DIR }}
- name: Cache ChromeDriver
id: cache-chromedriver
uses: actions/cache@v4
with:
path: ${{ env.OUTPUT_DIR }}/chromedriver
key: ${{ runner.os }}-arm-chromedriver-${{ inputs.chromedriver_version }}

- name: Download ChromeDriver
if: steps.cache-chromedriver.outputs.cache-hit != 'true'
run: |
curl -L -o chromedriver.zip ${{ env.CHROMEDRIVER_BASE_URL }}/${{ inputs.chromedriver_version }}/mac-arm64/chromedriver-mac-arm64.zip
unzip chromedriver.zip
mv chromedriver-mac-arm64/chromedriver ${{ env.OUTPUT_DIR }}/
rm -rf chromedriver-mac-arm64 chromedriver.zip
- name: Debug - Check Chromium and ChromeDriver
run: |
echo "Checking Chromium executable:"
if [ -d "${{ env.OUTPUT_DIR }}/Chromium.app" ]; then
CHROME_VERSION=$(${{ env.OUTPUT_DIR }}/Chromium.app/Contents/MacOS/Chromium --version)
echo "Chromium version: $CHROME_VERSION"
else
echo "Chromium.app not found"
fi
echo "Checking ChromeDriver executable:"
if [ -f "${{ env.OUTPUT_DIR }}/chromedriver" ]; then
CHROMEDRIVER_VERSION=$(${{ env.OUTPUT_DIR }}/chromedriver --version)
echo "ChromeDriver version: $CHROMEDRIVER_VERSION"
else
echo "ChromeDriver executable not found"
fi
- name: Package the app using PyInstaller
run: pipenv run pyinstaller main.spec

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macOS ARM Executable
path: dist/scrapegoat_macos_arm64
17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
chromium_version: '129.0.6668.58-1.1'
chromedriver_version: '131.0.6724.0'

build-macos-arm:
name: macOS ARM
uses: ./.github/workflows/build-mac-arm.yml
with:
python_version: '3.10'
chromium_version: '129.0.6668.70'
chromedriver_version: '131.0.6724.0'

build-windows:
name: Windows x64
uses: ./.github/workflows/build-windows.yml
Expand All @@ -43,7 +51,7 @@ jobs:
PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }}

create-release:
needs: [build-linux, build-macos, build-windows, build-docker]
needs: [build-linux, build-macos, build-macos-arm, build-windows, build-docker]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -67,6 +75,12 @@ jobs:
name: Windows Executable
path: artifacts

- name: Download macOS ARM artifact
uses: actions/download-artifact@v4
with:
name: macOS ARM Executable
path: artifacts

- name: Read release message
id: release_message
run: echo "message=$(cat RELEASENOTES.md)" >> $GITHUB_OUTPUT
Expand All @@ -77,6 +91,7 @@ jobs:
files: |
artifacts/scrapegoat_linux
artifacts/scrapegoat_macos_x64
artifacts/scrapegoat_macos_arm
artifacts/scrapegoat_windows_x64.exe
body: ${{ steps.release_message.outputs.message }}
tag_name: ${{ github.ref_name }}
Expand Down

0 comments on commit 4d8f81b

Please sign in to comment.