Skip to content

Commit 7c1af18

Browse files
committed
trying caching
1 parent b7b13bb commit 7c1af18

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ runs:
1616
- uses: actions/checkout@v4
1717
with:
1818
repository: "Adyen/adyen-swift-public-api-diff"
19-
ref: "0.7.0"
19+
#ref: "0.7.0"
20+
- name: Cache Swift Build
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
$(swift build --configuration release --show-bin-path)
25+
key: ${{ runner.os }}-swift-build-${{ github.sha }}
2026
- name: "Run Diff"
2127
run: |
2228
NEW=${{ inputs.new }}
@@ -25,7 +31,25 @@ runs:
2531
PROJECT_FOLDER=$PWD
2632
echo $PROJECT_FOLDER
2733
28-
swift run public-api-diff project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt"
34+
# Build the Swift project in release configuration and get the binary path
35+
BINARY_DIR_PATH=$(swift build --configuration release --show-bin-path)
36+
BINARY_PATH="$BINARY_DIR_PATH/public-api-diff"
37+
38+
# Check if the binary exists
39+
if [ ! -f "$BINARY" ]; then
40+
echo "Binary not found. Building the project..."
41+
swift build --configuration release
42+
# Check if the build was successful
43+
if [ $? -ne 0 ]; then
44+
echo "Build failed"
45+
exit 1
46+
fi
47+
else
48+
echo "Binary found at $BINARY_PATH"
49+
fi
50+
51+
# Run the binary $BINARY
52+
$BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt"
2953
cat "$PROJECT_FOLDER/logs.txt"
3054
3155
cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)