Skip to content

Commit

Permalink
fix: Add workflow_call config for secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
surpher committed Apr 26, 2024
1 parent d3e3edd commit 4e44971
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
name: "🤖 Unit tests"
needs: [sharedInputs, buildFFI]
uses: ./.github/workflows/test_macos14_arm64.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
rust-target-path: ${{ needs.sharedInputs.outputs.rust-target-path }}
binaries-path: ${{ needs.sharedInputs.outputs.binaries-path }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test_macos14_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
cache-restore-key:
required: true
type: string
secrets:
codecov_token:
required: true
workflow_dispatch:

jobs:
testMacOS14:
Expand Down Expand Up @@ -64,9 +68,10 @@ jobs:
- name: "⬆️ Upload coverage reports"
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.codecov_token }}
file: ".build/artifacts/${{ env.SCHEME }}-TestResultBundle.xcresult"
directory: ".build/artifacts"
fail_ci_if_error: true
flags: unittests
name: PactSwiftMockServer
Expand Down
15 changes: 9 additions & 6 deletions Support/build_test
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source "$SOURCE_DIR/utils.sh"

# Properties
SCHEME_TARGET_PAIRS=()
BUILD_PATH=".build"
BUILD_PATH="$SOURCE_DIR/../.build"

###############
# "private"
Expand Down Expand Up @@ -74,15 +74,18 @@ else
done
fi

# Remove build data by previous runs
echo "ℹ️ Cleanning up build data of previous runs in '$BUILD_PATH'"
executeCommand "rm -fr $BUILD_PATH"

# Run tests
for INDEX in "${SCHEME_TARGET_PAIRS[@]}"; do
SCHEME="${INDEX%%:::*}"
TARGET="${INDEX##*::}"
RESULT_BUNDLE_PATH="$BUILD_PATH/artifacts/$SCHEME-TestResultBundle.xcresult"

if [ $(folderExists "$RESULT_BUNDLE_PATH") == true ]; then
# Remove build data by previous runs
echo "ℹ️ Reoving results bundle from previous runs..."
executeCommand "rm -fr $RESULT_BUNDLE_PATH"
fi

echo "🧪 Running tests"
executeCommand "xcodebuild clean test -project \"PactSwiftMockServer.xcodeproj\" -scheme \"$SCHEME\" -destination \"$TARGET\" -enableCodeCoverage YES -derivedDataPath \"$BUILD_PATH/DerivedData\" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES | xcbeautify"
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"
done
16 changes: 16 additions & 0 deletions Support/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,19 @@ function executeCommand {
eval "$COMMAND"
fi
}

function folderExists {
if [ ! -d "$1" ]; then
echo false
else
echo true
fi
}

function fileExists {
if [ ! -f "$1" ]; then
echo false
else
echo true
fi
}

0 comments on commit 4e44971

Please sign in to comment.