Skip to content

Commit fc1f665

Browse files
committed
ci: add all main workflows as a prerequisite to release workflow
1 parent 92ce5db commit fc1f665

File tree

6 files changed

+239
-19
lines changed

6 files changed

+239
-19
lines changed

.github/workflows/codeql-package.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: "Security and Code-Quality scan with CodeQL - Package"
22

33
on:
4-
push:
5-
branches: [ "main" ]
64
pull_request:
75
branches: [ "main" ]
86
schedule:
97
- cron: '39 6 * * 1'
108
# Allows you to run this workflow manually from the Actions tab
119
workflow_dispatch:
10+
# Triggers the workflow on push request events but only for tag versions
11+
workflow_call:
1212

1313
jobs:
1414
analyze:
@@ -21,7 +21,7 @@ jobs:
2121

2222
#runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2323
#runs-on: [ self-hosted, macos ]
24-
runs-on: ['macos-14']
24+
runs-on: [ 'macos-14' ]
2525

2626
#timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
2727
timeout-minutes: 120
@@ -41,11 +41,11 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
# https://github.com/swiftlang/swift/releases
44-
swift: ["5.10.1"]
44+
swift: [ "5.10.1" ]
4545
# https://developer.apple.com/documentation/xcode-release-notes
46-
xcode: ["15.4"]
47-
language: [swift]
48-
build-mode: [manual]
46+
xcode: [ "15.4" ]
47+
language: [ swift ]
48+
build-mode: [ manual ]
4949
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
5050
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
5151
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how

.github/workflows/codeql-samples-quickstart.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: "Security and Code-Quality scan with CodeQL - Quickstart Sample"
22

33
on:
4-
push:
5-
branches: [ "main" ]
64
pull_request:
75
branches: [ "main" ]
86
schedule:
97
- cron: '28 6 * * 1'
108
# Allows you to run this workflow manually from the Actions tab
119
workflow_dispatch:
10+
# Triggers the workflow on push request events but only for tag versions
11+
workflow_call:
1212

1313
jobs:
1414
analyze:
@@ -120,4 +120,4 @@ jobs:
120120
uses: github/codeql-action/[email protected]
121121
if: success() || failure()
122122
with:
123-
category: "/language:${{matrix.language}}"
123+
category: "/language:${{matrix.language}}"
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# This workflow performs a full End 2 End test of the App
2+
# It runs the test on the last 5 iOS releases.
3+
4+
name: E2E Test with latest FusionAuth
5+
6+
on:
7+
# Triggers the workflow on pull request events but only for default and protected branches
8+
pull_request:
9+
branches: [ "main" ]
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
# Triggers the workflow on push request events but only for tag versions
13+
workflow_call:
14+
15+
env:
16+
fusionauth-docker-image-version: "1.55.1"
17+
18+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
19+
jobs:
20+
# This workflow contains a single job called "e2e-test"
21+
e2e-test:
22+
name: End 2 End Test
23+
24+
permissions:
25+
# required for all workflows
26+
security-events: write
27+
# only required for workflows in private repositories
28+
actions: read
29+
contents: read
30+
31+
# The type of runner that the job will run on
32+
# https://xcodereleases.com/
33+
# https://developer.apple.com/support/xcode/
34+
# https://developer.apple.com/documentation/xcode-release-notes
35+
runs-on: ${{ matrix.os }}
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
destination: [ "platform=iOS Simulator,OS=18.1,name=iPhone 15" ]
40+
xcode: [ "15.4" ]
41+
simulator-platform: [ "iOS" ]
42+
simulator-version: [ "18.1" ]
43+
swift: [ "5.10.1" ]
44+
os: [ "macos-14" ]
45+
postgresql-version: [ "16" ]
46+
47+
# Steps represent a sequence of tasks that will be executed as part of the job
48+
steps:
49+
# Initialize the latest version of Xcode.
50+
- name: Initialize latest xcode
51+
uses: maxim-lobanov/[email protected]
52+
with:
53+
xcode-version: ${{ matrix.xcode }}
54+
55+
# Remove any other Xcode version.
56+
- name: Remove old xcode versions
57+
run: |
58+
echo "Searching for Xcode versions:"
59+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
60+
echo "Removing old Xcode versions..."
61+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf
62+
echo "Available Xcode versions after removal:"
63+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
64+
65+
# Get the Xcode version.
66+
- name: Get Xcode version
67+
run: xcodebuild -version
68+
69+
# Install Xcodes.
70+
- name: Install Xcodes
71+
if: matrix.os == 'macos-13'
72+
shell: bash
73+
run: |
74+
brew install aria2
75+
brew install xcodes
76+
77+
# Install simulator platform.
78+
- name: Install Simulator
79+
if: matrix.os == 'macos-13'
80+
shell: bash
81+
run: |
82+
sudo xcodes runtimes
83+
sudo xcodes runtimes install '${{ matrix.simulator-platform }} ${{ matrix.simulator-version }}'
84+
sudo xcodes runtimes
85+
86+
# Initialize Swift in the matrix specified version.
87+
- name: Initialize Swift
88+
uses: swift-actions/[email protected]
89+
with:
90+
swift-version: ${{ matrix.swift }}
91+
92+
# Get the Swift version.
93+
- name: Get Swift version
94+
run: swift --version
95+
96+
# Checkout the repository.
97+
- name: Checkout repository
98+
uses: actions/[email protected]
99+
100+
# Install FusionAuth with brew.
101+
- name: Install PostgreSQL
102+
run: brew install postgresql@${{ matrix.postgresql-version }} -v
103+
104+
# Start PostgreSQL with brew.
105+
- name: Start PostgreSQL
106+
run: brew services start postgresql@${{ matrix.postgresql-version }} -v
107+
108+
# Add PostgreSQL to the PATH.
109+
- name: Add PostgreSQL to the PATH
110+
run: echo "$(brew --prefix postgresql@${{matrix.postgresql-version }})/bin" >> $GITHUB_PATH
111+
112+
# Add PostgreSQL fusionauth user with default password.
113+
- name: Add PostgreSQL fusionauth user
114+
run: psql --command="CREATE USER fusionauth PASSWORD 'fusionauth'" --command="\du" postgres
115+
116+
# Add PostgreSQL fusionauth database.
117+
- name: Add PostgreSQL fusionauth database
118+
run: createdb --owner=fusionauth fusionauth
119+
120+
# Tap FusionAuth Homebrew formulae.
121+
- name: Tap FusionAuth Homebrew formulae
122+
run: brew tap sonderformat-llc/fusionauth
123+
124+
# Install FusionAuth App with brew.
125+
- name: Install FusionAuth App
126+
run: brew install fusionauth-app -v
127+
128+
# Configure FusionAuth App with silent mode.
129+
- name: Configure FusionAuth App
130+
run: |
131+
echo "" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties
132+
echo "fusionauth-app.kickstart.file=$(echo $GITHUB_WORKSPACE)/Samples/Quickstart/fusionauth/${{ env.fusionauth-docker-image-version }}/kickstart/kickstart.json" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties
133+
echo "fusionauth-app.silent-mode=true" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties
134+
cat $(brew --prefix)/etc/fusionauth/fusionauth.properties
135+
136+
# Start FusionAuth App.
137+
- name: Start FusionAuth App
138+
run: brew services start fusionauth-app -v
139+
140+
# Check Brew services status.
141+
- name: Check Brew services status
142+
run: brew services list
143+
144+
# Check FusionAuth status 10 times with increasing wait times
145+
# Continue if FusionAuth status is OK or fail at the end.
146+
- name: Check FusionAuth status
147+
run: |
148+
for i in {1..10}; do
149+
if curl -s http://localhost:9011/api/status | grep -qi "ok"; then
150+
echo "FusionAuth is up and running."
151+
exit 0
152+
else
153+
echo "FusionAuth is not up and running. Waiting for $(expr 10 \* $i) seconds."
154+
sleep $(expr 10 \* $i)
155+
fi
156+
done
157+
cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log
158+
exit 1
159+
160+
# Check KickstartRunner execution 10 times with increasing wait times
161+
# Continue if KickstartRunner execution is OK or fail at the end.
162+
# TODO - use webhook instead https://fusionauth.io/docs/extend/events-and-webhooks/events/kickstart-success
163+
- name: Check KickstartRunner execution
164+
run: |
165+
for i in {1..10}; do
166+
if cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log | grep "KickstartRunner" | grep -q "Summary"; then
167+
echo "KickstartRunner execution is OK."
168+
exit 0
169+
else
170+
echo "KickstartRunner execution is not OK. Waiting for $(expr 10 \* $i) seconds."
171+
sleep $(expr 10 \* $i)
172+
fi
173+
done
174+
cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log
175+
exit 1
176+
177+
# Read FusionAuth App logs.
178+
- name: Read FusionAuth App logs
179+
run: cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log
180+
181+
# Connect to FusionAuth App.
182+
- name: Connect to FusionAuth App
183+
run: curl http://localhost:9011/api/status
184+
185+
# Perform the tests from the fusionauth-quickstart-swift-ios-native Sample.
186+
- name: Perform end to end tests
187+
run: set -o pipefail && xcodebuild test -workspace FusionAuthSDK.xcworkspace/ -scheme fusionauth-quickstart-swift-ios-native -destination "${{matrix.destination}}" -skipPackagePluginValidation
188+
189+
- name: Upload recording
190+
uses: actions/[email protected]
191+
if: ${{ failure() }}
192+
with:
193+
name: FusionAuth-${{ matrix.fusionauth-docker-image-version }}_${{ matrix.os }}_xcode-${{ matrix.xcode }}_swift-${{ matrix.swift }}_${{ matrix.simulator-platform }}-${{ matrix.simulator-version }}.xcresult
194+
path: /Users/runner/Library/Developer/Xcode/DerivedData/*/Logs/Test/*.xcresult

.github/workflows/mobsf.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: "Vulnerability Scan with MobSF"
22

33
on:
4-
push:
5-
branches: [ "main" ]
64
pull_request:
75
branches: [ "main" ]
86
schedule:
97
- cron: '30 6 * * 1'
108
# Allows you to run this workflow manually from the Actions tab
119
workflow_dispatch:
10+
# Triggers the workflow on push request events but only for tag versions
11+
workflow_call:
1212

1313
permissions:
1414
contents: read
@@ -58,4 +58,4 @@ jobs:
5858
env:
5959
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
if: success() || failure()
61-
run: reviewdog -f=sarif -diff="git diff FETCH_HEAD" -name="mobsf" -reporter=github-pr-check < mobsf.sarif.json
61+
run: reviewdog -f=sarif -diff="git diff FETCH_HEAD" -name="mobsf" -reporter=github-pr-check < mobsf.sarif.json

.github/workflows/release.yaml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,30 @@ concurrency:
1717
group: release
1818

1919
jobs:
20+
initial-e2e-test:
21+
name: Run Prerelease E2E Tests
22+
uses: ./.github/workflows/e2e-test-fusionauth-latest-ios-latest.yml
23+
24+
mobsf:
25+
name: Run Prerelease MobSF Scan
26+
uses: ./.github/workflows/mobsf.yml
27+
28+
swiftlint:
29+
name: Run Prerelease Swiftlint
30+
uses: ./.github/workflows/swiftlint.yml
31+
32+
codeql-package:
33+
name: Run Prerelease CodeQL Package Scan
34+
uses: ./.github/workflows/codeql-package.yml
35+
36+
codeql-samples-quickstart:
37+
name: Run Prerelease CodeQL Samples Quickstart Scan
38+
uses: ./.github/workflows/codeql-samples-quickstart.yml
39+
2040
prerelease-prep:
2141
name: Create Prerelease Pull Request
2242
runs-on: ubuntu-latest
43+
needs: [ initial-e2e-test, mobsf, swiftlint, codeql-package, codeql-samples-quickstart ]
2344
outputs:
2445
releases_created: ${{ steps.release.outputs.releases_created }}
2546
tag_name: ${{ steps.release.outputs.tag_name }}
@@ -31,17 +52,23 @@ jobs:
3152
config-file: ".github/prerelease-config.json"
3253
manifest-file: ".github/prerelease-manifest.json"
3354

34-
prerelease-e2e-test:
35-
name: Run Prerelease E2E Tests
55+
prerelease-e2e-test-fusionauth-matrix:
56+
name: Run Prerelease E2E Tests with FusionAuth Matrix
3657
if: ${{ needs.prerelease-prep.outputs.releases_created == 'true' && contains(needs.prerelease-prep.outputs.tag_name, 'rc') }}
3758
needs: prerelease-prep
3859
uses: ./.github/workflows/e2e-test-fusionauth-matrix-ios-latest.yml
3960

61+
prerelease-e2e-test-ios-matrix:
62+
name: Run Prerelease E2E Tests with iOS Matrix
63+
if: ${{ needs.prerelease-prep.outputs.releases_created == 'true' && contains(needs.prerelease-prep.outputs.tag_name, 'rc') }}
64+
needs: prerelease-prep
65+
uses: ./.github/workflows/e2e-test-fusionauth-latest-ios-matrix.yml
66+
4067
prerelease:
4168
name: Create Prerelease and Release Pull Request
4269
runs-on: ubuntu-latest
4370
if: ${{ needs.prerelease-prep.outputs.releases_created == 'true' && contains(needs.prerelease-prep.outputs.tag_name, 'rc') }}
44-
needs: [ prerelease-prep, prerelease-e2e-test ]
71+
needs: [ prerelease-prep, prerelease-e2e-test-fusionauth-matrix, prerelease-e2e-test-ios-matrix ]
4572
steps:
4673
- name: Pre Release Step
4774
run: |

.github/workflows/swiftlint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
name: "Code-Quality scan with SwiftLint"
22

33
on:
4-
# Triggers the workflow on push or pull request events but only for default and protected branches
5-
push:
6-
branches: [ "main" ]
74
pull_request:
85
branches: [ "main" ]
96
schedule:
107
- cron: '33 6 * * 1'
118
# Allows you to run this workflow manually from the Actions tab
129
workflow_dispatch:
10+
# Triggers the workflow on push request events but only for tag versions
11+
workflow_call:
1312

1413
jobs:
1514
scan-app:

0 commit comments

Comments
 (0)