Skip to content

Commit cfdb0ff

Browse files
ci: Safer Actions setup with opt. e2e tests (#214)
ci: Safer Actions setup with opt. it tests
1 parent 19fe73b commit cfdb0ff

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- 'main'
77
push:
@@ -18,41 +18,37 @@ jobs:
1818
- name: install sourcekitten
1919
run: brew install sourcekitten
2020
- uses: actions/checkout@v3
21-
with:
22-
ref: ${{ github.event.pull_request.head.ref }}
23-
repository: ${{ github.event.pull_request.head.repo.full_name }}
2421
- name: Run public API diff
2522
run: scripts/api_diff.sh ${{ matrix.module }}
2623

27-
Tests:
24+
Unit-Tests:
2825
runs-on: macOS-latest
2926
steps:
30-
- uses: actions/checkout@v3
31-
with:
32-
ref: ${{ github.event.pull_request.head.ref }}
33-
repository: ${{ github.event.pull_request.head.repo.full_name }}
34-
- name: Build and Test
35-
env:
36-
CLIENT_TOKEN: ${{ secrets.CONFIDENCE_CLIENT_TOKEN }}
37-
run: scripts/run_tests.sh $CLIENT_TOKEN
27+
- uses: actions/checkout@v3
28+
- name: Build and Run Unit Tests
29+
run: scripts/run_tests.sh
30+
31+
Integration-Tests:
32+
runs-on: macOS-latest
33+
if: ${{ secrets.CONFIDENCE_CLIENT_TOKEN != '' }}
34+
steps:
35+
- uses: actions/checkout@v3
36+
- name: Build and Run Integration Tests
37+
env:
38+
CLIENT_TOKEN: ${{ secrets.CONFIDENCE_CLIENT_TOKEN }}
39+
run: scripts/run_integration_tests.sh $CLIENT_TOKEN
3840

3941
DemoApp:
4042
runs-on: macOS-latest
4143
steps:
4244
- uses: actions/checkout@v3
43-
with:
44-
ref: ${{ github.event.pull_request.head.ref }}
45-
repository: ${{ github.event.pull_request.head.repo.full_name }}
4645
- name: Build Demo App
4746
run: ConfidenceDemoApp/scripts/build.sh
4847

4948
SwiftLint:
5049
runs-on: ubuntu-latest
5150
steps:
5251
- uses: actions/checkout@v3
53-
with:
54-
ref: ${{ github.event.pull_request.head.ref }}
55-
repository: ${{ github.event.pull_request.head.repo.full_name }}
5652
- name: GitHub Action for SwiftLint
5753
uses: norio-nomura/[email protected]
5854
with:

scripts/run_integration_tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
script_dir=$(dirname $0)
6+
root_dir="$script_dir/../"
7+
8+
test_runner_client_token=$1
9+
if [[ -z "${test_runner_client_token// }" ]]; then
10+
test_runner_client_token=$(security find-generic-password -w -s 'swift-provider-e2e' -a 'confidence-test')
11+
fi
12+
13+
(cd $root_dir && \
14+
TEST_RUNNER_CLIENT_TOKEN=$test_runner_client_token TEST_RUNNER_TEST_FLAG_NAME=$2 xcodebuild \
15+
-quiet \
16+
-scheme Confidence-Package \
17+
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' \
18+
-only-testing:ConfidenceTests/ConfidenceIntegrationTests \
19+
test)

scripts/run_tests.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@ set -e
55
script_dir=$(dirname $0)
66
root_dir="$script_dir/../"
77

8-
# Set the client token in your local keychain using the following command:
9-
# security add-generic-password -s 'swift-provider-e2e' -a 'confidence-test' -w 'TOKEN'
10-
# You can then run the script with no arguments - you will need to allow access the first time only.
11-
test_runner_client_token=$1
12-
if [[ -z "${test_runner_client_token// }" ]]; then
13-
test_runner_client_token=$(security find-generic-password -w -s 'swift-provider-e2e' -a 'confidence-test')
14-
fi
15-
16-
(cd $root_dir &&
17-
TEST_RUNNER_CLIENT_TOKEN=$test_runner_client_token TEST_RUNNER_TEST_FLAG_NAME=$2 xcodebuild \
8+
(cd $root_dir && \
9+
xcodebuild \
1810
-quiet \
1911
-scheme Confidence-Package \
2012
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' \
13+
-skip-testing:ConfidenceTests/ConfidenceIntegrationTests \
2114
test)

0 commit comments

Comments
 (0)