name: Actions ๐Ÿ˜Ž on: push: { branches: [main] } pull_request_target: paths-ignore: - ".github/**" jobs: tests: name: Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: 12.x - run: yarn - run: yarn lint - run: yarn test - run: yarn build || { echo "build command should always succeed" ; exit 61; } - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; } testAllModesLikeInTheReadme: name: Test in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: projectPath: - unity-project-with-correct-tests unityVersion: - 2019.2.11f1 testMode: - playmode - editmode steps: ########################### # Checkout # ########################### - name: Checkout (default) uses: actions/checkout@v2 if: github.event.event_type != 'pull_request_target' with: lfs: true - name: Checkout (pull_request_target) uses: actions/checkout@v2 if: github.event.event_type == 'pull_request_target' with: lfs: true ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} ########################### # Cache # ########################### - uses: actions/cache@v2 with: path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.projectPath }} restore-keys: | Library- - uses: ./ id: tests with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: ${{ matrix.testMode }} artifactsPath: ${{ matrix.testMode }}-artifacts customParameters: -profile SomeProfile -someBoolean -someValue exampleValue env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - uses: actions/upload-artifact@v2 with: name: Test results for ${{ matrix.testMode }} path: ${{ steps.tests.outputs.artifactsPath }} retention-days: 14 testRunnerInAllModes: name: Test all modes โœจ runs-on: ubuntu-latest strategy: fail-fast: false matrix: projectPath: - unity-project-with-correct-tests unityVersion: - 2019.2.11f1 steps: ########################### # Checkout # ########################### - name: Checkout (default) uses: actions/checkout@v2 if: github.event.event_type != 'pull_request_target' with: lfs: true - name: Checkout (pull_request_target) uses: actions/checkout@v2 if: github.event.event_type == 'pull_request_target' with: lfs: true ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} ########################### # Cache # ########################### - uses: actions/cache@v1.1.0 with: path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} restore-keys: | Library-${{ matrix.projectPath }}- Library- # Configure test runner - name: Run tests id: allTests uses: ./ with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: all # Test implicit artifactsPath, by not setting it env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Upload artifacts - name: Upload test results uses: actions/upload-artifact@v2 with: name: Test results (all) path: ${{ steps.allTests.outputs.artifactsPath }} retention-days: 14 testRunnerInEditMode: name: Test edit mode ๐Ÿ“ runs-on: ubuntu-latest strategy: fail-fast: false matrix: unityVersion: - 2019.2.11f1 projectPath: - unity-project-with-correct-tests steps: ########################### # Checkout # ########################### - name: Checkout (default) uses: actions/checkout@v2 if: github.event.event_type != 'pull_request_target' with: lfs: true - name: Checkout (pull_request_target) uses: actions/checkout@v2 if: github.event.event_type == 'pull_request_target' with: lfs: true ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} ########################### # Cache # ########################### - uses: actions/cache@v1.1.0 with: path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} restore-keys: | Library-${{ matrix.projectPath }}- Library- # Configure test runner - name: Run tests id: editMode uses: ./ with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: editmode artifactsPath: artifacts/editmode env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Upload artifacts - name: Upload test results uses: actions/upload-artifact@v2 with: name: Test results (edit mode) path: ${{ steps.editMode.outputs.artifactsPath }} retention-days: 14 testRunnerInPlayMode: name: Test play mode ๐Ÿ“บ runs-on: ubuntu-latest strategy: fail-fast: false matrix: projectPath: - unity-project-with-correct-tests unityVersion: - 2019.2.11f1 steps: ########################### # Checkout # ########################### - name: Checkout (default) uses: actions/checkout@v2 if: github.event.event_type != 'pull_request_target' with: lfs: true - name: Checkout (pull_request_target) uses: actions/checkout@v2 if: github.event.event_type == 'pull_request_target' with: lfs: true ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} ########################### # Cache # ########################### - uses: actions/cache@v1.1.0 with: path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} restore-keys: | Library-${{ matrix.projectPath }}- Library- # Configure test runner - name: Run tests id: playMode uses: ./ with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: playmode artifactsPath: artifacts/playmode env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Upload artifacts - name: Upload test results uses: actions/upload-artifact@v2 with: name: Test results (play mode) path: ${{ steps.playMode.outputs.artifactsPath }} retention-days: 14 testEachModeSequentially: name: Test each mode sequentially ๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ # don't try this at home (it's much slower) runs-on: ubuntu-latest strategy: fail-fast: false matrix: unityVersion: - 2019.2.11f1 projectPath: - unity-project-with-correct-tests steps: ########################### # Checkout # ########################### - name: Checkout (default) uses: actions/checkout@v2 if: github.event.event_type != 'pull_request_target' with: lfs: true - name: Checkout (pull_request_target) uses: actions/checkout@v2 if: github.event.event_type == 'pull_request_target' with: lfs: true ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} ########################### # Cache # ########################### - uses: actions/cache@v1.1.0 with: path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} restore-keys: | Library-${{ matrix.projectPath }}- Library- # Configure first test runner - name: Tests in editmode ๐Ÿ“ uses: ./ with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: editmode artifactsPath: artifacts/editmode env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Configure second test runner - name: Tests in playmode ๐Ÿ“บ uses: ./ with: projectPath: ${{ matrix.projectPath }} unityVersion: ${{ matrix.unityVersion }} testMode: playmode artifactsPath: artifacts/playmode env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # Upload combined artifacts - name: Upload combined test results uses: actions/upload-artifact@v2 with: name: Test results (combined) path: artifacts/ retention-days: 14