diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 2073ae2c8..2d2b7d0cb 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -4,10 +4,9 @@ on: [pull_request] jobs: build: - # Don't run for forks as secrets are unavailable. - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest name: Danger + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f12da909b..0386fd3f8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -2,12 +2,14 @@ name: Integration tests on: schedule: - - cron: '0 3 * * 1-5' + - cron: '0 2 * * 1-5' workflow_dispatch: jobs: integration_tests: + if: github.event.pull_request.head.repo.full_name == github.repository + name: Integration Tests runs-on: macos-12 @@ -19,6 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Brew bundle + run: + brew update && brew bundle && brew upgrade + - uses: actions/cache@v3 with: path: vendor/bundle diff --git a/.github/workflows/tests.yml b/.github/workflows/ui_tests.yml similarity index 83% rename from .github/workflows/tests.yml rename to .github/workflows/ui_tests.yml index a0f628561..abdd7726a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/ui_tests.yml @@ -1,8 +1,11 @@ -name: Tests +name: UI Tests on: - push: - branches: [ develop ] + workflow_dispatch: + + schedule: + - cron: '0 0 * * 1-5' + pull_request: jobs: @@ -13,7 +16,7 @@ jobs: concurrency: # When running on develop, use the sha to allow all runs of this workflow to run concurrently. # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. - group: ${{ github.ref == 'refs/heads/develop' && format('tests-develop-{0}', github.sha) || format('tests-{0}', github.ref) }} + group: ${{ github.ref == 'refs/heads/develop' && format('ui-tests-develop-{0}', github.sha) || format('ui-tests-{0}', github.ref) }} cancel-in-progress: true steps: @@ -26,6 +29,10 @@ jobs: with: lfs: true + - name: Brew bundle + run: + brew update && brew bundle && brew upgrade + - uses: actions/cache@v3 with: path: vendor/bundle @@ -33,17 +40,13 @@ jobs: restore-keys: | ${{ runner.os }}-gems- - - name: Brew bundle - run: - brew update && brew bundle && brew upgrade - - name: Bundle install run: | bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run tests - run: bundle exec fastlane tests + run: bundle exec fastlane ui_tests - name: Archive artifacts uses: actions/upload-artifact@v3 diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 000000000..e5e991b86 --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,45 @@ +name: Unit Tests + +on: + workflow_dispatch: + + push: + branches: [ develop ] + + pull_request: + +jobs: + tests: + name: Tests + runs-on: macos-12 + + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + + - name: Brew bundle + run: + brew update && brew bundle && brew upgrade + + - uses: actions/cache@v3 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + + - name: Bundle install + run: | + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + + - name: Run tests + run: bundle exec fastlane unit_tests + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 \ No newline at end of file diff --git a/Dangerfile.swift b/Dangerfile.swift index 5aee32db3..11caf78fc 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -49,7 +49,6 @@ let allowList = ["stefanceriu", "manuroe", "gileluard", "phlniji", - "MaximeEvrard42", "aringenbach"] let requiresSignOff = !allowList.contains(where: { @@ -64,7 +63,7 @@ if requiresSignOff { }.isEmpty if !hasPRBodySignOff, isMissingCommitsSignOff { - fail("Please add a sign-off to either the PR description or to the commits themselves.") + warn("Please add a sign-off to either the PR description or to the commits themselves.") } } diff --git a/ElementX.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme b/ElementX.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme index 7edcae007..a226fa630 100644 --- a/ElementX.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme +++ b/ElementX.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme @@ -29,7 +29,7 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES" - onlyGenerateCoverageForSpecifiedTargets = "NO" + onlyGenerateCoverageForSpecifiedTargets = "YES" systemAttachmentLifetime = "keepNever"> + + + +