Skip to content

Commit

Permalink
Add actions for building Processing 3 artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
philippitts committed Aug 8, 2023
1 parent 2bfa0a5 commit edb764d
Show file tree
Hide file tree
Showing 9 changed files with 347 additions and 56 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/p3_linux_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build GUI for Linux - Processing 3

on:
workflow_dispatch:
pull_request:
branches: [master, development]
push:
branches: [master, development]

permissions:
id-token: write
contents: read

env:
AWS_REGION : us-east-1

jobs:
build:
name: Build for Linux - Processing 3
runs-on: ubuntu-20.04

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

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies

- name: Install Python Dependencies
run: pip install -r release_script/requirements.txt

- name: Download and Unzip Processing
run: |
mkdir -p $GITHUB_WORKSPACE/temp
cd $GITHUB_WORKSPACE/temp
curl -O -L --insecure https://github.com/processing/processing/releases/download/processing-0270-3.5.4/processing-3.5.4-linux64.tgz
tar -xzvf processing-3.5.4-linux64.tgz
ls
- name: Add Processing to PATH
run: |
sudo su -c "ln -s $GITHUB_WORKSPACE/temp/processing-3.5.4/processing-java /usr/local/bin/processing-java"
- name: Test processing-java command
run: |
processing-java --help
- name: Copy libraries to Processing
run: |
mkdir -p $HOME/sketchbook/libraries/
cp -a $GITHUB_WORKSPACE/OpenBCI_GUI/libraries/. $HOME/sketchbook/libraries/
- name: Run Unit Tests
run: |
echo "Unit tests cannot be run on Linux without attached display."
echo "https://github.com/processing/processing/wiki/Running-without-a-Display"
- name: Build GUI
run: |
touch temp/timestamp.txt
touch temp/versionstring.txt
python $GITHUB_WORKSPACE/release_script/make-release.py --no-prompts
GUI_COMMIT_TIME=`cat temp/timestamp.txt`
GUI_VERSION_STRING=`cat temp/versionstring.txt`
- name: Configure AWS credentials from Production account
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}

- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v7

- name: Store DMG on AWS
run: |
cd $GITHUB_WORKSPACE
ls
CURRENT_BRANCH=${{ steps.branch-name.outputs.head_ref_branch }}
echo $CURRENT_BRANCH
aws s3 rm s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_linux64.zip"
aws s3 cp $GITHUB_WORKSPACE/. s3://openbci-public-gui-v6/${CURRENT_BRANCH}/processing_3 --recursive --exclude "*" --include "openbcigui_*_linux64.zip"
aws s3 cp $GITHUB_WORKSPACE/. s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_linux64.zip"
113 changes: 113 additions & 0 deletions .github/workflows/p3_mac_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build GUI for macOS - Processing 3

on:
workflow_dispatch:
pull_request:
branches: [master, development]
push:
branches: [master, development]

permissions:
id-token: write
contents: read

env:
AWS_REGION : us-east-1

jobs:
build:
name: Build for macOS - Processing 3
runs-on: macos-latest

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

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies

- name: Install Python Dependencies
run: pip install -r release_script/requirements.txt

- name: Download and Unzip Processing
run: |
curl -O -L --insecure https://github.com/processing/processing/releases/download/processing-0270-3.5.4/processing-3.5.4-macosx.zip
unzip processing-3.5.4-macosx.zip
ls
- name: Move Processing.app to Applications
run: |
mv Processing.app /Applications/Processing.app
- name: Add Processing to PATH
run: |
echo "$GITHUB_WORKSPACE/release_script/mac_only/" >> $GITHUB_PATH
chmod +x $GITHUB_WORKSPACE/release_script/mac_only/processing-java
- name: Check GITHUB PATH
run: echo $GITHUB_PATH

- name: Test processing-java command
run: |
processing-java --help
- name: Copy libraries to Processing
run: |
mkdir -p $HOME/Documents/Processing/libraries/
cp -a $GITHUB_WORKSPACE/OpenBCI_GUI/libraries/. $HOME/Documents/Processing/libraries/
- name: Run Unit Tests
run: |
ls
python $GITHUB_WORKSPACE/GuiUnitTests/run-unittests.py
- name: Save Encrypted Certificate to File
run: |
echo $MAC_CERTIFICATE_ENCRYPTED | base64 --decode > $GITHUB_WORKSPACE/release_script/mac_only/Certificates_2023.p12.enc
env:
MAC_CERTIFICATE_ENCRYPTED: ${{ secrets.MAC_CERTIFICATE_ENCRYPTED }}

- name: Decrypt Certificate
run: |
openssl version
openssl enc -aes-256-cbc -a -d -pbkdf2 -in $GITHUB_WORKSPACE/release_script/mac_only/Certificates_2023.p12.enc -out $GITHUB_WORKSPACE/release_script/mac_only/Certificates.p12 -k "$OPENSSL_CERT_K"
env:
OPENSSL_CERT_K: ${{ secrets.OPENSSL_CERT_K }}

- name: Add OSX Signing Certificate to Keychain
uses: apple-actions/import-codesign-certs@v2
with:
p12-filepath: ${{ github.workspace }}/release_script/mac_only/Certificates.p12
p12-password: ${{ secrets.CERTIFICATE_P12_PASSWORD }}

- name: Build GUI
run: |
mkdir $GITHUB_WORKSPACE/temp
touch temp/timestamp.txt
touch temp/versionstring.txt
python $GITHUB_WORKSPACE/release_script/make-release.py --no-prompts
GUI_COMMIT_TIME=`cat temp/timestamp.txt`
GUI_VERSION_STRING=`cat temp/versionstring.txt`
- name: Configure AWS credentials from Production account
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}

- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v7

- name: Store DMG on AWS S3
run: |
cd $GITHUB_WORKSPACE
ls
CURRENT_BRANCH=${{ steps.branch-name.outputs.head_ref_branch }}
echo $CURRENT_BRANCH
aws s3 rm s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_macosx.dmg"
aws s3 cp $GITHUB_WORKSPACE/. s3://openbci-public-gui-v6/${CURRENT_BRANCH}/processing_3 --recursive --exclude "*" --include "openbcigui_*_macosx.dmg"
aws s3 cp $GITHUB_WORKSPACE/. s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_macosx.dmg"
133 changes: 133 additions & 0 deletions .github/workflows/p3_windows_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Build GUI for Windows - Processing 3

on:
workflow_dispatch:
pull_request:
branches: [master, development]
push:
branches: [master, development]

permissions:
id-token: write
contents: read

env:
AWS_REGION : us-east-1

jobs:
build:
name: Build for Windows - Processing 3
runs-on: windows-2019

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Install Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
cache: 'pip' # caching pip dependencies

- name: Install Python Dependencies
run: |
python -m pip install requests
python -m pip install beautifulsoup4
- name: Install Processing
run: |
mkdir %GITHUB_WORKSPACE%\temp
cd %GITHUB_WORKSPACE%\temp
curl -O -L --insecure https://github.com/processing/processing/releases/download/processing-0270-3.5.4/processing-3.5.4-windows64.zip
ls -l %GITHUB_WORKSPACE%\temp
unzip processing-3.5.4-windows64.zip
ls -l %GITHUB_WORKSPACE%\temp\processing-3.5.4
mkdir %userprofile%\documents\processing\libraries
xcopy %GITHUB_WORKSPACE%\OpenBCI_GUI\libraries\* %userprofile%\documents\processing\libraries /s /i /q
ls -l %userprofile%\documents\processing\libraries
shell: cmd

- name: Set Path
run: |
echo %GITHUB_WORKSPACE%\temp\processing-3.5.4 >> %GITHUB_PATH%
echo C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64 >> %GITHUB_PATH%
ls -l "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
shell: cmd

- name: Print Path
run: echo %GITHUB_PATH%
shell: cmd

- name: Explicitly run processing-java
run: |
%GITHUB_WORKSPACE%\temp\processing-3.5.4\processing-java.exe --help
shell: cmd

- name: Check processing-java command
run: |
set PATH=%PATH%;%GITHUB_WORKSPACE%\temp\processing-3.5.4
processing-java --help
shell: cmd

- name: Run Unit Tests
run: |
set PATH=%PATH%;%GITHUB_WORKSPACE%\temp\processing-3.5.4
ls -l
python %GITHUB_WORKSPACE%\GuiUnitTests\run-unittests.py
shell: cmd

- name: Build without Signing
if: ${{ true }}
run: |
echo %cd%
ls
set PATH=%PATH%;%GITHUB_WORKSPACE%\temp\processing-3.5.4
set PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64
type nul > temp/versionstring.txt
type nul > temp/timestamp.txt
python %GITHUB_WORKSPACE%\release_script\make-release.py --no-prompts
shell: cmd

- name: Decrypt pfx files
if: ${{ false }}
run: |
iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))
appveyor-tools\secure-file -decrypt $env:GITHUB_WORKSPACE\release_script\windows_only\0a2d0e9821bd184a1d969a1db3630c92-SHA2.pfx.enc -secret $env:PFX_SECRET -salt $env:PFX_SALT -out $env:GITHUB_WORKSPACE\release_script\windows_only\0a2d0e9821bd184a1d969a1db3630c92-SHA2.pfx
ls -l $env:GITHUB_WORKSPACE\release_script\windows_only
env:
PFX_PASS: ${{ secrets.PFX_PASS }}
PFX_SECRET: ${{ secrets.PFX_SECRET }}
PFX_SALT: ${{ secrets.PFX_SALT }}

- name: Build and Sign
if: ${{ false }}
run: |
python %GITHUB_WORKSPACE%\release_script\make-release.py --no-prompts --pfx-password %PFX_PASS% --pfx-path %GITHUB_WORKSPACE%\release_script\windows_only\0a2d0e9821bd184a1d969a1db3630c92-SHA2.pfx
env:
PFX_PASS: ${{ secrets.PFX_PASS }}
PFX_SECRET: ${{ secrets.PFX_SECRET }}
PFX_SALT: ${{ secrets.PFX_SALT }}
shell: cmd

- name: Configure AWS credentials from Production account
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}

- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v7

- name: Store Build on AWS
run: |
cd ${{ github.workspace }}
ls
echo "${{ steps.branch-name.outputs.head_ref_branch }}"
set S3_BRANCH_FOLDER=s3://openbci-public-gui-v6/${{ steps.branch-name.outputs.head_ref_branch }}
echo %S3_BRANCH_FOLDER%
aws s3 rm s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_windows64.zip"
aws s3 cp ${{ github.workspace }}/. %S3_BRANCH_FOLDER%/processing_3 --recursive --exclude "*" --include "openbcigui_*_windows64.zip"
aws s3 cp ${{ github.workspace }}/. s3://openbci-public-gui-v6/latest/processing_3 --recursive --exclude "*" --include "openbcigui_*_windows64.zip"
shell: cmd
File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 0 additions & 55 deletions .github/workflows/windows_build_test.yml

This file was deleted.

Loading

0 comments on commit edb764d

Please sign in to comment.