Skip to content

🔄ci-dogu-agent

🔄ci-dogu-agent #607

Workflow file for this run

name: 🔄ci-dogu-agent
on:
workflow_dispatch:
inputs:
maxos_runner:
type: choice
description: 'macos runner'
options:
- 'self-hosted-macos'
- 'macos-latest'
default: 'self-hosted-macos'
clean:
type: boolean
description: 'clean git repo'
default: false
# push:
# branches: ['main']
# paths:
# - '.github/workflows/build-dost.yml'
# - 'prebuilds/protocol-exporter/**.proto'
# - 'packages/typescript-dev-private/build-tools/**'
# - 'packages/typescript-private/device-server/**'
# - 'packages/typescript-private/host-agent/**'
# - 'projects/go-device-controller/**'
# - 'projects/ios-device-agent/**'
# - 'projects/android-device-agent/**'
# - 'projects/device-server/**'
# - 'projects/host-agent/**'
# - 'nm-space/projects/dost/**'
# pull_request:
# branches: ['main']
env:
YARN_CHECKSUM_BEHAVIOR: update yarn
CSC_FOR_PULL_REQUEST: true
concurrency:
group: ci-dogu-agent
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
max-parallel: 99
matrix:
runner: ${{ [github.event.inputs.maxos_runner, 'windows-2019'] }}

Check failure on line 49 in .github/workflows/ci-dogu-agent.yml

View workflow run for this annotation

GitHub Actions / 🔄ci-dogu-agent

Invalid workflow file

The workflow is not valid. .github/workflows/ci-dogu-agent.yml (Line: 49, Col: 17): Unexpected symbol: '['. Located at position 1 within expression: [github.event.inputs.maxos_runner, 'windows-2019'] .github/workflows/ci-dogu-agent.yml (Line: 49, Col: 17): Unexpected value '${{ [github.event.inputs.maxos_runner, 'windows-2019'] }}'
runs-on: ['${{ matrix.runner }}']
env:
RUNNER_TOOL_CACHE: ${{ github.workspace }}/runner-tool-cache
GO_VERSION: '1.18.4'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
clean: ${{ github.event.inputs.clean }}
fetch-depth: 0
- name: Cache Node.js environment
uses: actions/setup-node@v3
with:
node-version: '16.20'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Cache Yarn Unplugged
uses: actions/cache@v3
id: cache_yarn_unplugged
env:
cache-name: cache-yarn-unplugged
with:
path: ${{ github.workspace }}/.yarn/unplugged
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Cache Android buildfiles
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/projects/android-device-agent/android/app/build
${{ github.workspace }}/projects/android-device-agent/android/.gradle
key: ${{ runner.os }}-cache_android_files-${{ hashFiles('projects/android-device-agent/android/app/src/**') }} # It doesn't have to match exactly.
restore-keys: |
${{ runner.os }}-cache_android_files-
- name: Cache Go buildfiles
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/projects/go-device-controller/build
key: ${{ runner.os }}-cache_go_files-${{ hashFiles('projects/go-device-controller/internal/**') }} # It doesn't have to match exactly.
restore-keys: |
${{ runner.os }}-cache_go_files-
- name: Cache Electron
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.electron-cache
key: ${{ runner.os }}-cache_elctrons
- name: Cache Third-Party
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/third-party
key: ${{ runner.os }}-cache-thirdparty-${{ hashFiles('scripts/third-parties/download.ts') }}
- name: Windows - Msys2 - MIGW64 - Setup for cgo
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
msystem: MINGW64
location: ${{ github.workspace }}
install: >-
git
base-devel
mingw-w64-x86_64-gcc
- name: Windows - Setup Cmake
if: runner.os == 'Windows'
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.25.1
ninjaVersion: 1.11.1
- name: Macos - Setup Cmake
if: runner.os == 'macOS'
run: brew install cmake
env:
HOMEBREW_NO_AUTO_UPDATE: 1
continue-on-error: true
- name: Install the Apple certificate and provisioning profile
if: runner.os == 'macOS'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.DOGU_MACOS_CERTIFICATE_BASE64 }}
BUILD_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DOGU_MACOS_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.DOGU_MACOS_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.DOGU_MACOS_WILDCARD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.DOGU_MACOS_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
DEVELOPMENT_CERTIFICATE_PATH=$RUNNER_TEMP/build_development_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_APPLE_DOGU_DEVELOPMENT_CERTIFICATE_BASE64" | base64 --decode -o $DEVELOPMENT_CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $DEVELOPMENT_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Common - Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/*/go.sum'
- name: Common - Set up JDK 11 for android build
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Common - Setup Android SDK
uses: android-actions/[email protected]
- if: steps.cache_yarn_unplugged.outputs.cache-hit != 'true'
name: Newbie
run: |
yarn run newbie:cicd
- name: Build Packages
run: |
yarn workspace dogu run build:packages
- name: Download, Build third-party
run: |
yarn third-party:download:build
env:
DOGU_APPLE_API_KEY_ID: ${{ secrets.DOGU_APPLE_API_KEY_ID }}
DOGU_APPLE_API_ISSUER_ID: ${{ secrets.DOGU_APPLE_API_ISSUER_ID }}
- name: Dogu Agent - Newbie nm-space
run: |
yarn workspace dogu run newbie:nm-space
- name: create dotEnv deploy
run: |
echo "DOGU_GITHUB_TOKEN=${{ secrets.DOGU_GITHUB_TOKEN }}" > .env.deploy-secret
echo "DOGU_APPLE_API_KEY_ID=${{ secrets.DOGU_APPLE_API_KEY_ID }}" >> .env.deploy-secret
echo "DOGU_APPLE_API_ISSUER_ID=${{ secrets.DOGU_APPLE_API_ISSUER_ID }}" >> .env.deploy-secret
echo "DOGU_APPLE_API_PRIVATEKEY=${{ secrets.DOGU_APPLE_API_PRIVATEKEY }}" >> .env.deploy-secret
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_PROD_ACCESS_KEY_ID }}" >> .env.deploy-secret
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}" >> .env.deploy-secret
working-directory: ./nm-space/projects/dost
- name: create dotEnv development
run: |
echo "DOGU_DEVICE_SERVER_PORT=5001" > .env.device-server
echo "DOGU_RUN_TYPE=development" >> .env.device-server
echo "NODE_ENV=development" >> .env.device-server
echo "DOGU_DEVICE_PLATFORM_ENABLED=windows,macos,android,ios" >> .env.device-server
echo "DOGU_API_BASE_URL=https://api.dev.dogutech.io" > .env.host-agent
echo "DOGU_DEVICE_SERVER_HOST_PORT=localhost:5001" >> .env.host-agent
echo "DOGU_HOST_TOKEN=" >> .env.host-agent
echo "DOGU_RUN_TYPE=development" >> .env.host-agent
echo "NODE_ENV=development" >> .env.host-agent
echo "DOGU_HOST_AGENT_PORT=5100" >> .env.host-agent
echo "DOGU_APPUPDATE_PROVIDER=s3" > .env.dost
echo "DOGU_APPUPDATE_URL=public.dev.dogutech.io" >> .env.dost
echo "DOGU_APPUPDATE_SUBPATH=dost" >> .env.dost
echo "DOGU_APPUPDATE_REGION=ap-northeast-2" >> .env.dost
working-directory: ./nm-space/projects/dost
- name: Dogu Agent - Set productName
run: |
yarn util:set-productname "Dogu-Agent-ci-development" && yarn
working-directory: ./nm-space/projects/dost
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Dogu Agent - Set version 0.0.1
run: |
yarn util:set-version 0.0.1
working-directory: ./nm-space/projects/dost
- name: Dogu Agent - Build
run: |
yarn run build && yarn run deploy:notarize
working-directory: ./nm-space/projects/dost
env:
ELECTRON_CACHE: ${{ github.workspace }}/.electron-cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.electron-cache/electron-builder
- name: Upload dogu-agent windows
if: ${{ success() }} && runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: 'dogu-agent-${{ runner.os }}'
path: |
./nm-space/projects/dost/dist/*.exe
- name: Upload dogu-agent mac
if: ${{ success() }} && runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: 'dogu-agent-${{ runner.os }}'
path: |
./nm-space/projects/dost/dist/*.zip
send-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ always() }}
steps:
- name: Send Slack
uses: dogu-team/[email protected]
with:
template: 'CI'
slack-channel-id: 'C03PL9TC44Q'
result-status: ${{ needs.build.result }}
ignore-notify: ${{ needs.build.result == 'success' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}