Skip to content

Commit

Permalink
Update GitHub Actions (#39)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Schmiedmayer <PSchmiedmayer@users.noreply.github.com>
  • Loading branch information
PSchmiedmayer authored Jul 13, 2023
1 parent 9789800 commit 38e6c5d
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# This source file is part of the Stanford CS342 - Building for Digital Health class
# It is a copy of the xcodebuild-or-fastlane.yml GitHub Action workflow as copied from the Stanford Biodesign Digital Health organization.
#
# SPDX-FileCopyrightText: 2022 Stanford University
#
# SPDX-License-Identifier: MIT
#

name: Release

on:
release:
types: [created]
workflow_dispatch:

jobs:
releasetag:
name: Tag Release
uses: StanfordBDHG/.github/.github/workflows/action-release-tag.yml@v2
secrets:
access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
user: PaulsAutomationBot
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# This source file is part of the Stanford CS342 - Building for Digital Health class
# It is a copy of the xcodebuild-or-fastlane.yml GitHub Action workflow as copied from the Stanford Biodesign Digital Health organization.
#
# SPDX-FileCopyrightText: 2022 Stanford University
#
# SPDX-License-Identifier: MIT
#

name: Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
reuse_action:
name: REUSE Compliance Check
uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2
69 changes: 62 additions & 7 deletions .github/workflows/xcodebuild-or-fastlane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This source file is part of the Stanford CS342 - Building for Digital Health class
# It is a copy of the xcodebuild-or-fastlane.yml GitHub Action workflow as copied from the Stanford Biodesign Digital Health organization.
#
# SPDX-FileCopyrightText: 2022 Stanford University
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#
Expand All @@ -22,11 +22,21 @@ on:
required: false
type: string
default: '["macos-latest"]'
xcodeversion:
description: 'The Xcode version used for the build'
required: false
type: string
default: 'latest-stable'
scheme:
description: 'The scheme in the Xcode project. Either use `scheme` to use xcodebuild, `fastlanelane` to use fastlane, or a custom command using `customcommand`'
required: false
type: string
default: ''
test:
description: 'A flag indicating if the tests of the Xcode project scheme should run'
required: false
type: boolean
default: true
fastlanelane:
description: 'The lane of the fastlane command. Either use `scheme` to use xcodebuild, `fastlanelane` to use fastlane, or a custom command using `customcommand`'
required: false
Expand Down Expand Up @@ -57,6 +67,36 @@ on:
required: false
type: boolean
default: false
codeql:
description: 'Use CodeQL code scanning'
required: false
type: boolean
default: false
secrets:
BUILD_CERTIFICATE_BASE64:
description: 'The Base64 version of the Apple signing certificate to build your iOS application.'
required: false
P12_PASSWORD:
description: 'The password for the Apple signing certificate.'
required: false
BUILD_PROVISION_PROFILE_BASE64:
description: 'The Base64 version of the Apple provisioning profile to build your iOS application.'
required: false
KEYCHAIN_PASSWORD:
description: 'A password for the keychain that will be created on the runner instance.'
required: false
APP_STORE_CONNECT_API_KEY_ID:
description: 'The key ID of the API key created in the App Store Connect API keys section.'
required: false
APP_STORE_CONNECT_ISSUER_ID:
description: 'The issuer ID of the App Store Connect API is displayed in the App Store Connect API keys section.'
required: false
APP_STORE_CONNECT_API_KEY_BASE64:
description: 'The content of the key created in App Store Connect condensed into a Base64 representation, e.g., using base64 -i AuthKey_ABCDEFGHIJ.p8 | pbcopy.'
required: false
APPLE_ID:
description: 'The Apple ID you use to access the App Store Connect API.'
required: false

jobs:
build_and_test:
Expand All @@ -70,7 +110,7 @@ jobs:
- uses: maxim-lobanov/setup-xcode@v1
if: "!env.selfhosted"
with:
xcode-version: latest-stable
xcode-version: ${{ inputs.xcodeversion }}
- name: Check environment
run: |
xcodebuild -version
Expand Down Expand Up @@ -134,6 +174,12 @@ jobs:
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Initialize CodeQL
if: ${{ inputs.codeql }}
uses: github/codeql-action/init@v2
with:
languages: swift
db-location: '${{ inputs.path }}/.codeql'
- name: Run custom command
if: ${{ inputs.customcommand != '' }}
run: ${{ inputs.customcommand }}
Expand All @@ -148,12 +194,18 @@ jobs:
- name: Build and test (xcodebuild)
if: ${{ inputs.scheme != '' }}
run: |
if ${{ inputs.test }}; then
XCODECOMMAND="test"
CODECOVERAGEFLAG="-enableCodeCoverage YES"
else
XCODECOMMAND="build"
fi
set -o pipefail \
&& xcodebuild test \
&& xcodebuild $XCODECOMMAND \
-scheme ${{ inputs.scheme }} \
-sdk iphonesimulator \
-destination "name=iPhone 14 Pro Max" \
-enableCodeCoverage YES \
-destination "name=iPhone 14 Pro" \
$CODECOVERAGEFLAG \
-derivedDataPath ".derivedData" \
-resultBundlePath ${{ inputs.scheme }}.xcresult \
CODE_SIGN_IDENTITY="" \
Expand All @@ -167,12 +219,15 @@ jobs:
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }}
APPLE_ID: ${{ secrets.APPLE_ID }}
- name: Perform CodeQL Analysis
if: ${{ inputs.codeql }}
uses: github/codeql-action/analyze@v2
- name: Upload artifact
if: always()
if: ${{ (success() || failure()) && inputs.artifactname != '' }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifactname }}
path: ${{ inputs.artifactname }}
path: ${{ inputs.path }}/${{ inputs.artifactname }}
- name: Clean up keychain and provisioning profile
if: "(inputs.setupsigning && env.selfhosted) || failure()"
run: |
Expand Down

0 comments on commit 38e6c5d

Please sign in to comment.