Invitation Code Verification Module #197
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This source file is part of the Stanford Spezi open-source project | |
# | |
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
name: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
buildandtest: | |
name: Build and Test Swift Package | |
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 | |
with: | |
artifactname: SpeziFirebase-Package.xcresult | |
runsonlabels: '["macOS", "self-hosted"]' | |
scheme: SpeziFirebase-Package | |
buildandtestuitests: | |
name: Build and Test UI Tests | |
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 | |
with: | |
artifactname: UITests.xcresult | |
runsonlabels: '["macOS", "self-hosted"]' | |
setupfirebaseemulator: true | |
path: Tests/UITests | |
customcommand: | | |
firebase emulators:exec 'set -o pipefail && xcodebuild test -project UITests.xcodeproj -scheme TestApp -destination "platform=iOS Simulator,name=iPhone 15 Pro" -resultBundlePath UITests.xcresult -derivedDataPath ".derivedData" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify' | |
testandcoverage: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: spezi-invitation-code | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check environment | |
run: | | |
echo "env.selfhosted: ${{ env.selfhosted }}" | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: 'spezi-invitation-code/package-lock.json' | |
- name: Cache Firebase Emulators | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/firebase/emulators | |
key: ${{ runner.os }}-${{ runner.arch }}-firebase-emulators-${{ hashFiles('~/.cache/firebase/emulators/**') }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: '17' | |
- name: Install Firebase CLI Tools | |
run: npm install -g firebase-tools | |
- name: Install Node Dependencies | |
run: npm ci | |
- name: Run the tests | |
run: | | |
echo -n "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}" | base64 -d > "$RUNNER_TEMP/google-application-credentials.json" | |
export GOOGLE_APPLICATION_CREDENTIALS="$RUNNER_TEMP/google-application-credentials.json" | |
echo "Stored the Google application credentials at $GOOGLE_APPLICATION_CREDENTIALS" | |
npm test | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
if: ${{ always() }} | |
with: | |
token: ${{ secrets.token }} | |
working-directory: spezi-invitation-code | |
- name: Clean up Google application credentials | |
run: | | |
rm -rf $RUNNER_TEMP/google-application-credentials.json || true | |
uploadcoveragereport: | |
name: Upload Coverage Report | |
needs: [buildandtest, buildandtestuitests, testandcoverage] | |
uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 | |
with: | |
coveragereports: SpeziFirebase-Package.xcresult UITests.xcresult | |
secrets: | |
token: ${{ secrets.CODECOV_TOKEN }} |