Skip to content

Commit ca26558

Browse files
committed
ci: Pass github.workspace to reusable workflow
1 parent 4e44971 commit ca26558

File tree

4 files changed

+56
-19
lines changed

4 files changed

+56
-19
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: "Build and Test"
22

33
on:
4-
pull_request:
5-
branches:
6-
- 'main'
74
push:
85
branches:
9-
- 'main'
106
- 'chore/**'
117
- 'docs/**'
128
- 'feat/**'
@@ -58,6 +54,7 @@ jobs:
5854
binaries-path: ${{ needs.sharedInputs.outputs.binaries-path }}
5955
cache-key: ${{ needs.sharedInputs.outputs.cache-key }}
6056
cache-restore-key: ${{ needs.sharedInputs.outputs.cache-restore-key }}
57+
submit-coverage-report: false
6158

6259
testMacOS13:
6360
name: "🤖 Unit tests"

.github/workflows/pr.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Build and Test"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
env:
9+
RUST_TARGET_PATH: pact-reference/rust/target
10+
BINARIES_PATH: Resources
11+
CACHE_KEY: build-ffi-rust
12+
CACHE_RESTORE_KEY: build-ffi-rust
13+
14+
jobs:
15+
sharedInputs:
16+
name: "🔣 Shared envs"
17+
runs-on: ubuntu-latest
18+
outputs:
19+
rust-target-path: ${{ env.RUST_TARGET_PATH }}
20+
binaries-path: ${{ env.BINARIES_PATH }}
21+
cache-key: ${{ env.CACHE_KEY }}
22+
cache-restore-key: ${{ env.CACHE_RESTORE_KEY }}
23+
24+
steps:
25+
- run: echo "Just a hacky workaround for passing envs to jobs expecting them... ¯\_(ツ)_/¯"
26+
27+
buildFFI:
28+
name: "📦 Dependencies"
29+
needs: [sharedInputs]
30+
uses: ./.github/workflows/build_rust_binaries.yml
31+
with:
32+
rust-target-path: ${{ needs.sharedInputs.outputs.rust-target-path }}
33+
binaries-path: ${{ needs.sharedInputs.outputs.binaries-path }}
34+
cache-key: ${{ needs.sharedInputs.outputs.cache-key }}
35+
cache-restore-key: ${{ needs.sharedInputs.outputs.cache-restore-key }}
36+
37+
testMacOS14:
38+
name: "🤖 Unit tests"
39+
needs: [sharedInputs, buildFFI]
40+
uses: ./.github/workflows/test_macos14_arm64.yml
41+
secrets:
42+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
43+
with:
44+
rust-target-path: ${{ needs.sharedInputs.outputs.rust-target-path }}
45+
binaries-path: ${{ needs.sharedInputs.outputs.binaries-path }}
46+
cache-key: ${{ needs.sharedInputs.outputs.cache-key }}
47+
cache-restore-key: ${{ needs.sharedInputs.outputs.cache-restore-key }}
48+
submit-coverage-report: true

.github/workflows/test_macos14_arm64.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
cache-restore-key:
1616
required: true
1717
type: string
18+
submit-coverage-report:
19+
required: true
20+
type: boolean
1821
secrets:
1922
codecov_token:
2023
required: true
@@ -31,8 +34,10 @@ jobs:
3134
include:
3235
- scheme: "PactSwiftMockServer-iOS"
3336
destination: "platform=iOS Simulator,name=iPhone 15 Pro"
37+
submit_code_coverage: true
3438
- scheme: "PactSwiftMockServer-macOS"
3539
destination: "arch=arm64"
40+
submit_code_coverage: true
3641

3742
env:
3843
SCHEME: ${{ matrix.scheme }}
@@ -67,12 +72,8 @@ jobs:
6772
sh Support/build_test
6873
6974
- name: "⬆️ Upload coverage reports"
75+
if: ${{ matrix.submit_code_coverage && inputs.submit-coverage-report }}
7076
uses: codecov/codecov-action@v4
7177
with:
7278
token: ${{ secrets.codecov_token }}
73-
file: ".build/artifacts/${{ env.SCHEME }}-TestResultBundle.xcresult"
74-
directory: ".build/artifacts"
75-
fail_ci_if_error: true
76-
flags: unittests
77-
name: PactSwiftMockServer
7879
verbose: true

Support/build_test

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ source "$SOURCE_DIR/utils.sh"
2626

2727
# Properties
2828
SCHEME_TARGET_PAIRS=()
29-
BUILD_PATH="$SOURCE_DIR/../.build"
3029

3130
###############
3231
# "private"
@@ -78,14 +77,6 @@ fi
7877
for INDEX in "${SCHEME_TARGET_PAIRS[@]}"; do
7978
SCHEME="${INDEX%%:::*}"
8079
TARGET="${INDEX##*::}"
81-
RESULT_BUNDLE_PATH="$BUILD_PATH/artifacts/$SCHEME-TestResultBundle.xcresult"
8280

83-
if [ $(folderExists "$RESULT_BUNDLE_PATH") == true ]; then
84-
# Remove build data by previous runs
85-
echo "ℹ️ Reoving results bundle from previous runs..."
86-
executeCommand "rm -fr $RESULT_BUNDLE_PATH"
87-
fi
88-
89-
echo "🧪 Running tests"
90-
executeCommand "xcodebuild -project \"PactSwiftMockServer.xcodeproj\" -scheme \"$SCHEME\" -destination \"$TARGET\" -enableCodeCoverage YES -derivedDataPath \"$BUILD_PATH/DerivedData\" -resultBundlePath \"$RESULT_BUNDLE_PATH\" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES build test | xcbeautify"
81+
executeCommand "xcodebuild -project \"PactSwiftMockServer.xcodeproj\" -scheme \"$SCHEME\" -destination \"$TARGET\" -enableCodeCoverage YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES build test | xcbeautify"
9182
done

0 commit comments

Comments
 (0)