👾

GameCIのTest/Buildを試す

2021/12/18に公開

すでに記事を書いている人がいっぱいいるので、新規情報はない. ただの個人メモ.

試したコード:

setup (activation)

1. alf作成

無料の個人ライセンスは、ビルドにライセンス署名情報ファイル(.ulf)が必要なのでまずはactivationする

.github/workflows/activation.yml
name: Acquire activation file
on:
  workflow_dispatch: {}
jobs:
  activation:
    name: Request manual activation file 🔑
    runs-on: ubuntu-latest
    steps:

      - name: Request manual activation file
        id: getManualLicenseFile
        uses: game-ci/unity-request-activation-file@v2
	with:
	  unityVersion: 2021.1.28f1

      - name: Expose as artifact
        uses: actions/upload-artifact@v2
        with:
          name: ${{ steps.getManualLicenseFile.outputs.filePath }}
          path: ${{ steps.getManualLicenseFile.outputs.filePath }}

手動実行

  • Github site > Actions > "Acquire activation file" > Run workflow
  • Artifacts > Unity_v2021.1.28f1.alf をDL

2. ulf作成

  1. alfアップロード
  2. ulfダウンロード

test

.github/workflows/test.yml
name: Run Test
on:
  workflow_dispatch: {}
jobs:
  test:
    name: Run Test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout project
        uses: actions/checkout@v2

      - name: Run Test
        uses: game-ci/unity-test-runner@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          projectPath: .
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          unityVersion: 2021.1.28f1

      - uses: actions/upload-artifact@v2
        if: always()
        with:
          name: Test results
          path: artifacts

実行してみたら、うまくtestとfailとsuccessが反映されてた.

test panel

test resultsを落としてみると

test results on github

中身はeditmode,playmodeの結果xmlとその実行ログが格納されていた.
親切..!

finder: Test results

実行時間はほぼスクリプトも依存もない状態で5minだった.

build

.github/workflows/build_webgl.yml
name: Build 😎

on: 
  push:
    branches:
      - master
  workflow_dispatch: {}

jobs:
  build:
    name: Build my project ✨
    runs-on: ubuntu-latest
    steps:
      # Checkout
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          lfs: true

      # Cache
      - uses: actions/cache@v2
        with:
          path: Library
          key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-

      # Build
      - name: Build project
        uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          targetPlatform: WebGL
          unityVersion: 2021.1.28f1

      # Github Pages
      - name: Github Pages
        uses: JamesIves/github-pages-deploy-action@4.1.7
        with:
          branch: gh-pages
          folder: build

      # Output
      - uses: actions/upload-artifact@v2
        with:
          name: Build
          path: build

Github > Settings > Pages

  • gh-pagesを選択してsave

とりあえずdeployはうまくいった!

Android/iOSもimageあるっぽいので試してみたい..!

Discussion