2021-11-19 11:22:27 +03:00
|
|
|
name: macOS
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: macos-latest
|
2022-11-22 13:02:52 +03:00
|
|
|
|
2021-11-19 11:22:27 +03:00
|
|
|
steps:
|
2023-11-23 16:33:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-11-19 11:22:27 +03:00
|
|
|
|
2023-08-25 11:23:59 +03:00
|
|
|
- name: Read variables from repo
|
|
|
|
run: cat .github/workflows/env >> $GITHUB_ENV
|
|
|
|
|
2022-09-20 14:52:47 +03:00
|
|
|
- name: Check app versions
|
|
|
|
run: |
|
2022-11-24 18:33:37 +03:00
|
|
|
python3 set-version.py
|
2022-09-20 14:52:47 +03:00
|
|
|
git diff --exit-code
|
|
|
|
|
2023-11-29 12:41:45 +03:00
|
|
|
- name: Set up Python
|
2023-12-12 13:06:27 +03:00
|
|
|
uses: actions/setup-python@v5
|
2023-11-29 12:41:45 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ env.PYVER }}
|
|
|
|
|
2023-12-08 18:04:13 +03:00
|
|
|
- name: Set up CocoaPods
|
|
|
|
uses: maxim-lobanov/setup-cocoapods@v1
|
|
|
|
with:
|
|
|
|
podfile-path: macos/Podfile.lock
|
|
|
|
|
2022-11-24 18:33:37 +03:00
|
|
|
- name: Cache helper
|
|
|
|
id: cache-helper
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/macos/helper
|
|
|
|
assets/licenses/helper.json
|
|
|
|
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
|
|
|
|
|
2021-11-19 11:22:27 +03:00
|
|
|
- name: Install dependencies
|
2022-11-24 18:33:37 +03:00
|
|
|
if: steps.cache-helper.outputs.cache-hit != 'true'
|
2021-11-19 11:22:27 +03:00
|
|
|
run: |
|
|
|
|
brew update
|
|
|
|
brew install swig
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install poetry
|
|
|
|
|
2022-11-24 18:33:37 +03:00
|
|
|
- name: Build the Helper
|
|
|
|
if: steps.cache-helper.outputs.cache-hit != 'true'
|
|
|
|
run: ./build-helper.sh
|
|
|
|
|
2022-04-27 15:42:05 +03:00
|
|
|
- uses: subosito/flutter-action@v2
|
2021-11-19 11:22:27 +03:00
|
|
|
with:
|
2022-05-12 09:36:47 +03:00
|
|
|
channel: 'stable'
|
2022-04-20 17:27:14 +03:00
|
|
|
architecture: 'x64'
|
2023-08-25 11:23:59 +03:00
|
|
|
flutter-version: ${{ env.FLUTTER }}
|
2021-11-19 11:22:27 +03:00
|
|
|
- run: flutter config --enable-macos-desktop
|
|
|
|
- run: flutter --version
|
|
|
|
|
2023-11-29 12:41:45 +03:00
|
|
|
- name: Run lints/tests
|
2023-11-30 19:48:04 +03:00
|
|
|
env:
|
|
|
|
SKIP: ${{ steps.cache-helper.outputs.cache-hit == 'true' && 'mypy,flake8,black,bandit' || ''}}
|
2021-11-19 13:20:57 +03:00
|
|
|
run: |
|
2023-11-30 19:48:04 +03:00
|
|
|
pip install pre-commit
|
|
|
|
pre-commit run --all-files
|
2021-11-19 13:20:57 +03:00
|
|
|
flutter test
|
2021-11-19 12:23:01 +03:00
|
|
|
|
2021-11-19 11:22:27 +03:00
|
|
|
- name: Build the app
|
2022-09-22 15:37:06 +03:00
|
|
|
run: |
|
|
|
|
export VERSION_NAME=`./set-version.py | head -n 1 | sed 's/-.*$//g'`
|
|
|
|
flutter build macos --build-name=$VERSION_NAME
|
2021-11-19 11:22:27 +03:00
|
|
|
|
2022-04-04 16:43:04 +03:00
|
|
|
- name: Check generated files
|
|
|
|
run: git diff --exit-code
|
|
|
|
|
2022-06-23 15:31:36 +03:00
|
|
|
- name: Create dmg
|
|
|
|
run: |
|
|
|
|
brew install create-dmg
|
|
|
|
mkdir source_folder
|
|
|
|
cp -R build/macos/Build/Products/Release/"Yubico Authenticator.app" source_folder
|
2022-11-10 13:48:39 +03:00
|
|
|
cp resources/icons/dmg-background.png .
|
2022-06-28 16:47:19 +03:00
|
|
|
sh create-dmg.sh
|
2022-06-23 15:31:36 +03:00
|
|
|
|
2021-11-19 11:22:27 +03:00
|
|
|
- name: Rename and archive app bundle
|
|
|
|
run: |
|
|
|
|
export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3)
|
|
|
|
mkdir deploy
|
2022-06-23 15:31:36 +03:00
|
|
|
mv yubioath-desktop.dmg deploy
|
2022-11-18 16:33:23 +03:00
|
|
|
tar -czf deploy/yubioath-desktop-${REF}.app.tar.gz -C build/macos/Build/Products/Release "Yubico Authenticator.app"
|
2022-11-10 13:48:39 +03:00
|
|
|
mv create-dmg.sh deploy
|
|
|
|
mv resources/icons/dmg-background.png deploy
|
2022-11-10 17:17:30 +03:00
|
|
|
mv macos/helper.entitlements deploy
|
|
|
|
mv macos/helper-sandbox.entitlements deploy
|
|
|
|
mv macos/Runner/Release.entitlements deploy
|
2022-11-18 16:33:23 +03:00
|
|
|
mv macos/release-macos.sh deploy
|
2021-11-19 11:22:27 +03:00
|
|
|
|
|
|
|
- name: Upload artifact
|
2023-12-18 15:15:56 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-11-19 11:22:27 +03:00
|
|
|
with:
|
|
|
|
name: yubioath-desktop-macos
|
|
|
|
path: deploy
|