Skip to content

Commit

Permalink
Merge pull request #16 from nai-kon/Ver3.2
Browse files Browse the repository at this point in the history
merge Ver3.2 to master
  • Loading branch information
nai-kon authored Feb 10, 2024
2 parents ecbb540 + 268a238 commit 601aa57
Show file tree
Hide file tree
Showing 102 changed files with 9,850 additions and 5,284 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: [ "master" ]
workflow_dispatch:
workflow_call:

permissions:
contents: read
Expand All @@ -23,10 +24,10 @@ jobs:
- 3.11
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-ver }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-ver }}

Expand Down
112 changes: 87 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,42 @@ name: release
on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: read

jobs:
test:
uses: ./.github/workflows/lint_test.yml
uses: ./.github/workflows/pytest.yml

build:
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
python-ver: [3.11]
includes:
- os: macos-latest
build_script: ./build_mac.sh
zip_name: PlaySK-PianoRoll-Reader-Mac.x64.zip
# only build for Windows. Because Mac needs software notarization but I don't have $99 for it.
os: [windows-latest, macos-latest, macos-latest-xlarge]
include:
- os: windows-latest
build_script: ./build_win.bat
zip_name: PlaySK-PianoRoll-Reader-Win.x64.zip
build_cmd: build_win.bat
zip_name: PlaySK-PianoRoll-Reader-Win.x64.zip
- os: macos-latest
build_cmd: bash build_mac.sh
zip_name: PlaySK-PianoRoll-Reader-Mac.x64.zip
- os: macos-latest-xlarge
build_cmd: bash build_mac.sh
zip_name: PlaySK-PianoRoll-Reader-Mac.ARM.zip

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-ver }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-ver }}

Expand All @@ -42,25 +48,81 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Build cython code
run: pushd src/cis_decoder/; poetry run python setup.py build_ext --inplace; popd;

- name: build binary
run: ${{ matrix.build_script }}
run: poetry run ${{ matrix.build_cmd }}

- name: Windows, collect binary and zip
if: startsWith(matrix.os, "windows")
- name: Windows x64, collect release files
if: startsWith( matrix.os , 'windows' )
run: Compress-Archive -Path "dist/PlaySK Piano Roll Reader/*","sample_scans/" -DestinationPath ${{ matrix.zip_name }}

- name: Mac Arm/X64, collect binary and zip
if: startsWith(matrix.os, "mac")
- name: Mac arm/x64, codesign app
if: startsWith( matrix.os, 'mac' )
env:
CERT_B64: ${{ secrets.CERT_B64 }}
CERT_PW: ${{ secrets.CERT_PW }}
CERT_NAME: ${{ secrets.CERT_NAME }}
KEYCHAIN_PW: ${{ secrets.KEYCHAIN_PW }}
run: |
pushd dist
security create-keychain -p "$KEYCHAIN_PW" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PW" build.keychain
echo $CERT_B64 | base64 --decode > cert.p12
security import cert.p12 -k build.keychain -P "$CERT_PW" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PW" build.keychain
/usr/bin/codesign --deep --force --options=runtime --entitlements ../entitlements.plist --sign "$CERT_NAME" --timestamp "PlaySK Piano Roll Reader.app/"
- name: Mac arm/x64, notarize app
if: startsWith( matrix.os, 'mac' )
env:
NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }}
NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }}
NOTARY_PW: ${{ secrets.NOTARY_PW }}
run: |
mkdir tozip \
cp -pr dist/* tozip/ \
cp -pr sample_scans tozip/ \
zip -r -q ${{ matrix.zip_name }} tozip
pushd dist
mkdir to_notarize
mv "PlaySK Piano Roll Reader.app" playsk_config to_notarize/
ditto -c -k -rsrc --keepParent to_notarize archive.zip
xcrun notarytool store-credentials "notary_profile" --apple-id "$NOTARY_APPLE_ID" --team-id "$NOTARY_TEAM_ID" --password "$NOTARY_PW"
xcrun notarytool submit archive.zip --keychain-profile "notary_profile" --wait
mv to_notarize/* .
rm -rf to_notarize archive.zip
xcrun stapler staple "PlaySK Piano Roll Reader.app"
- name: Mac arm/x64, create dmg installer and collect release files
if: startsWith( matrix.os, 'mac' )
run: |
pushd dist
brew install create-dmg
test -f PlaySK-Installer.dmg && rm PlaySK-Installer.dmg
create-dmg --volname "PlaySK Installer" --background ../docs/dmg-bg.tiff --window-pos 200 120 --window-size 800 500 --icon-size 100 --icon "PlaySK Piano Roll Reader.app" 100 100 --add-file "playsk_config" playsk_config 100 300 --hide-extension "PlaySK Piano Roll Reader.app" --app-drop-link 600 200 "PlaySK-Installer.dmg" "PlaySK Piano Roll Reader.app"
popd
mv dist/PlaySK-Installer.dmg "dist/How to use Mac.png" dist/3rd-party-license.txt .
zip -qr ${{ matrix.zip_name }} sample_scans/ PlaySK-Installer.dmg "How to use Mac.png" "3rd-party-license.txt"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: ${{ matrix.zip_name }}
name: ${{ matrix.zip_name }}
path: ${{ matrix.zip_name }}

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: assets

- name: Display structure of downloaded files
run: ls -la assets/

# currently no solution for double zipped
- name: create release
uses: softprops/action-gh-release@v1
with:
draft: true
files: ./assets/*/*
5 changes: 2 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"recommendations": [
"ms-python.flake8",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance"
"streetsidesoftware.code-spell-checker",
"charliermarsh.ruff"
]
}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"cSpell.ignoreWords": [
"Colour"
]
],
"python.testing.pytestArgs": [
"test"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
Loading

0 comments on commit 601aa57

Please sign in to comment.