Skip to content

Commit 4e44971

Browse files
committed
fix: Add workflow_call config for secrets
1 parent d3e3edd commit 4e44971

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

.github/workflows/build_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
name: "🤖 Unit tests"
5252
needs: [sharedInputs, buildFFI]
5353
uses: ./.github/workflows/test_macos14_arm64.yml
54+
secrets:
55+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
5456
with:
5557
rust-target-path: ${{ needs.sharedInputs.outputs.rust-target-path }}
5658
binaries-path: ${{ needs.sharedInputs.outputs.binaries-path }}

.github/workflows/test_macos14_arm64.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
cache-restore-key:
1616
required: true
1717
type: string
18+
secrets:
19+
codecov_token:
20+
required: true
21+
workflow_dispatch:
1822

1923
jobs:
2024
testMacOS14:
@@ -64,9 +68,10 @@ jobs:
6468
6569
- name: "⬆️ Upload coverage reports"
6670
uses: codecov/codecov-action@v4
67-
env:
68-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6971
with:
72+
token: ${{ secrets.codecov_token }}
73+
file: ".build/artifacts/${{ env.SCHEME }}-TestResultBundle.xcresult"
74+
directory: ".build/artifacts"
7075
fail_ci_if_error: true
7176
flags: unittests
7277
name: PactSwiftMockServer

Support/build_test

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

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

3131
###############
3232
# "private"
@@ -74,15 +74,18 @@ else
7474
done
7575
fi
7676

77-
# Remove build data by previous runs
78-
echo "ℹ️ Cleanning up build data of previous runs in '$BUILD_PATH'"
79-
executeCommand "rm -fr $BUILD_PATH"
80-
8177
# Run tests
8278
for INDEX in "${SCHEME_TARGET_PAIRS[@]}"; do
8379
SCHEME="${INDEX%%:::*}"
8480
TARGET="${INDEX##*::}"
81+
RESULT_BUNDLE_PATH="$BUILD_PATH/artifacts/$SCHEME-TestResultBundle.xcresult"
82+
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
8588

8689
echo "🧪 Running tests"
87-
executeCommand "xcodebuild clean test -project \"PactSwiftMockServer.xcodeproj\" -scheme \"$SCHEME\" -destination \"$TARGET\" -enableCodeCoverage YES -derivedDataPath \"$BUILD_PATH/DerivedData\" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES | xcbeautify"
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"
8891
done

Support/utils.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,19 @@ function executeCommand {
2929
eval "$COMMAND"
3030
fi
3131
}
32+
33+
function folderExists {
34+
if [ ! -d "$1" ]; then
35+
echo false
36+
else
37+
echo true
38+
fi
39+
}
40+
41+
function fileExists {
42+
if [ ! -f "$1" ]; then
43+
echo false
44+
else
45+
echo true
46+
fi
47+
}

0 commit comments

Comments
 (0)