Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwritten #92

Open
wants to merge 107 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
3695cd4
Create swift-api.yml
rozaychen May 30, 2024
fddd484
Create apiBreakage.yml
rozaychen May 30, 2024
ca82303
Delete .github/workflows/name: SwiftAPIBreakage on: pull_request: …
rozaychen May 30, 2024
3d65ad1
Merge pull request #1 from rozaychen/rozaychen-patch-1
rozaychen May 30, 2024
69fef3f
Update apiBreakage.yml
rozaychen May 30, 2024
d8c2cf2
Update apiBreakage.yml
rozaychen May 30, 2024
06a517f
Update apiBreakage.yml
rozaychen May 30, 2024
79b6371
Update Amplify.swift
rozaychen May 30, 2024
6fcb615
Merge pull request #2 from rozaychen/rozaychen-patch-2
rozaychen May 30, 2024
b3c6d2d
chore: Test No API Break
rozaychen May 30, 2024
6f702cd
Merge pull request #4 from rozaychen/rozaychen-patch-4
rozaychen May 30, 2024
9c64c95
Update Amplify.swift
rozaychen May 30, 2024
4baff0a
Delete .github/workflows directory
rozaychen May 31, 2024
eb49b7f
Create apiBreak.yml
rozaychen May 31, 2024
083a839
Add API file
rozaychen May 31, 2024
ecd3536
Merge pull request #5 from rozaychen/rozaychen-patch-4
rozaychen May 31, 2024
0a1edb5
Change to adaptation version of swift-api-diff
rozaychen May 31, 2024
1cb3b45
Update
rozaychen May 31, 2024
3348251
Temporary change 5.9 to 5.1
rozaychen May 31, 2024
403cc88
Update Package.swift
rozaychen May 31, 2024
dff148c
Update apiBreak.yml
rozaychen May 31, 2024
b98b0a4
Update apiBreak.yml
rozaychen May 31, 2024
035457a
Update apiBreak.yml
rozaychen May 31, 2024
b5f9c19
Create apiBreakTest.yml
rozaychen May 31, 2024
528b8a9
Update apiBreakTest.yml
rozaychen May 31, 2024
4148986
Update apiBreakTest.yml
rozaychen May 31, 2024
186008c
Create check_deletions.yml
rozaychen Jun 3, 2024
c7b5943
Create check_deletions.sh
rozaychen Jun 3, 2024
453a30f
Update check_deletions.sh
rozaychen Jun 3, 2024
cf6f55a
Update check_deletions.yml
rozaychen Jun 3, 2024
c37e805
Update check_deletions.sh
rozaychen Jun 3, 2024
c4c7b13
Update apiBreakTest.yml
rozaychen Jun 3, 2024
187124d
Update apiBreakTest.yml
rozaychen Jun 3, 2024
add7a32
Update apiBreakTest.yml
rozaychen Jun 3, 2024
8436cee
Update apiBreakTest.yml
rozaychen Jun 3, 2024
f3fde69
Update apiBreakTest.yml
rozaychen Jun 3, 2024
5642c99
Update apiBreakTest.yml
rozaychen Jun 3, 2024
db912ee
Update apiBreakTest.yml
rozaychen Jun 3, 2024
f28abf9
Update apiBreakTest.yml
rozaychen Jun 3, 2024
8ee15f8
Update apiBreakTest.yml
rozaychen Jun 3, 2024
8406537
Update apiBreakTest.yml
rozaychen Jun 3, 2024
2516d20
Update apiBreakTest.yml
rozaychen Jun 3, 2024
f052eaf
Update apiBreakTest.yml
rozaychen Jun 3, 2024
7c518a1
Delete .github/workflows/apiBreak.yml
rozaychen Jun 3, 2024
a1d4e83
Update apiBreakTest.yml
rozaychen Jun 3, 2024
e6ecc04
Update apiBreakTest.yml
rozaychen Jun 3, 2024
5d0905f
Update apiBreakTest.yml
rozaychen Jun 3, 2024
032e45b
Update apiBreakTest.yml
rozaychen Jun 3, 2024
6841e1f
Update apiBreakTest.yml
rozaychen Jun 3, 2024
491014b
Update apiBreakTest.yml
rozaychen Jun 4, 2024
38ed9f4
Update apiBreakTest.yml
rozaychen Jun 4, 2024
2e39879
Update apiBreakTest.yml
rozaychen Jun 4, 2024
60bf553
Update apiBreakTest.yml
rozaychen Jun 4, 2024
a442bf1
Update apiBreakTest.yml
rozaychen Jun 4, 2024
ba29076
Update apiBreakTest.yml
rozaychen Jun 4, 2024
4ff6b65
Update apiBreakTest.yml
rozaychen Jun 4, 2024
13d3af6
Update apiBreakTest.yml
rozaychen Jun 4, 2024
8360cef
Update apiBreakTest.yml
rozaychen Jun 4, 2024
eaa9bc7
Add Local Script
rozaychen Jun 5, 2024
02c0fdb
Update check_api_breakage.sh
rozaychen Jun 5, 2024
fe66be1
Update apiBreakTest.yml
rozaychen Jun 5, 2024
75553c7
Update apiBreakTest.yml
rozaychen Jun 5, 2024
6cf9da3
Update apiBreakTest.yml
rozaychen Jun 5, 2024
99c1857
Update apiBreakTest.yml
rozaychen Jun 6, 2024
5c1969c
Update apiBreakTest.yml
rozaychen Jun 6, 2024
3ec6ddf
Update apiBreakTest.yml
rozaychen Jun 6, 2024
6df254d
Update apiBreakTest.yml
rozaychen Jun 6, 2024
390c199
Update apiBreakTest.yml
rozaychen Jun 6, 2024
22da4eb
Update apiBreakTest.yml
rozaychen Jun 6, 2024
1042fbe
Update apiBreakTest.yml
rozaychen Jun 6, 2024
5d61d2c
Update .gitignore
rozaychen Jun 6, 2024
7bd2463
Update API Dump
rozaychen Jun 6, 2024
b04bde5
Update apiBreakTest.yml
rozaychen Jun 6, 2024
9152215
Test Break API
rozaychen Jun 6, 2024
fc68a8d
Delete .github/workflows/check_deletions.yml
rozaychen Jun 6, 2024
6d597d0
Update apiBreakTest.yml
rozaychen Jun 6, 2024
0fcf042
Update apiBreakTest.yml
rozaychen Jun 6, 2024
5dc5b41
Update apiBreakTest.yml
rozaychen Jun 6, 2024
eef811a
Update API dump for new version
github-actions[bot] Jun 6, 2024
7ddafdc
Merge pull request #26 from rozaychen/test-caching
rozaychen Jun 6, 2024
a9631c9
Update apiBreakTest.yml
rozaychen Jun 6, 2024
3257f47
Update apiBreakTest.yml
rozaychen Jun 6, 2024
f0f54b7
Update apiBreakTest.yml
rozaychen Jun 6, 2024
f8674ae
Update apiBreakTest.yml
rozaychen Jun 6, 2024
68c1fa6
Update apiBreakTest.yml
rozaychen Jun 6, 2024
8d681c0
Update apiBreakTest.yml
rozaychen Jun 7, 2024
2aeff34
Update apiBreakTest.yml
rozaychen Jun 7, 2024
5593f59
Update apiBreakTest.yml
rozaychen Jun 7, 2024
e66f6a2
Update apiBreakTest.yml
rozaychen Jun 7, 2024
687a25e
Update apiBreakTest.yml
rozaychen Jun 7, 2024
ee682cb
Update check_api_breakage.sh
rozaychen Jun 10, 2024
ce816c1
Update check_api_breakage.sh
rozaychen Jun 10, 2024
c164827
Update check_api_breakage.sh
rozaychen Jun 10, 2024
c55f204
Update apiBreakTest.yml
rozaychen Jun 10, 2024
67cbbe7
Update MLPlugin
rozaychen Jun 10, 2024
7364e0c
Test 2 modules break
rozaychen Jun 10, 2024
ece42ef
Update API dumps for new version
github-actions[bot] Jun 10, 2024
bd9680b
Merge pull request #29 from rozaychen/test-rozay-6
rozaychen Jun 10, 2024
3167028
Update apiBreakTest.yml
rozaychen Jun 10, 2024
8cdb957
Update apiBreakTest.yml
rozaychen Jun 10, 2024
e9842c4
Update apiBreakTest.yml
rozaychen Jun 10, 2024
38ffbe0
Update apiBreakTest.yml
rozaychen Jun 10, 2024
9fba742
Merge branch 'aws-amplify:main' into main
rozaychen Jun 11, 2024
50a1b56
Update apiBreakTest.yml
rozaychen Jun 12, 2024
7e73ce5
Test Overwritten Issue
rozaychen Jun 12, 2024
585a4f8
Update API dumps for new version
github-actions[bot] Jun 12, 2024
d00c9de
Merge pull request #60 from rozaychen/Overwritten-test
rozaychen Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .github/workflows/apiBreakTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: "Solution1b"

on:
pull_request:

jobs:
buildAndCheckAPIBreakage:
name: Build and Check API Breakage
runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
fetch-depth: 0

- name: Setup and Run Swift API Diff
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Swift version: $(swift --version)"
echo "Swift package manager version: $(swift package --version)"
swift package resolve

# Ensure we are in the correct directory
cd $GITHUB_WORKSPACE

# Run swift-api-diff commands here directly
NEW_API_DIR=$(mktemp -d)
OLD_API_DIR=$(mktemp -d)
SDK_PATH=$(xcrun --show-sdk-path)

# Get all library module names
modules=$(swift package dump-package | jq -r '.products | map(select(.name == "Amplify" or .name == "CoreMLPredictionsPlugin")) | map(.name) | .[]')
echo "Modules: $modules"

echo "Fetching old version..."
git checkout ${{ github.event.pull_request.base.sha }}
for module in $modules; do
cp "api-dump/${module}.json" "$OLD_API_DIR/${module}.json"
done
# Use the api-dump/${module}.json file from the base branch directly
# if [ ! -f api-dump/${module}.json ]; then
# echo "Old API file does not exist in the base branch"
# exit 1
# fi

echo "Fetching new version..."
git checkout ${{ github.sha }}
git log -1 # Print the commit info for debugging
swift build> /dev/null 2>&1 || { echo "Failed to build new version"; exit 1; }
for module in $modules; do
swift api-digester -sdk "$SDK_PATH" -dump-sdk -module "$module" -o "$NEW_API_DIR/${module}.json" -I .build/debug || { echo "Failed to dump new SDK for module $module"; exit 1; }
done

# Compare APIs for each module and capture the output
api_diff_output=""
for module in $modules; do
swift api-digester -sdk "$SDK_PATH" -diagnose-sdk --input-paths "$OLD_API_DIR/${module}.json" --input-paths "$NEW_API_DIR/${module}.json" >> "api-diff-report-${module}.txt" 2>&1
module_diff_output=$(grep -v '^/\*' "api-diff-report-${module}.txt" | grep -v '^$' || true)
if [ -n "$module_diff_output" ]; then
api_diff_output="${api_diff_output}\n**Module: ${module}**\n${module_diff_output}\n"
fi
done
echo "API_DIFF_OUTPUT<<EOF" >> $GITHUB_ENV
if [ -n "$api_diff_output" ]; then
echo "### 💔 Public API Breaking Change detected:" >> $GITHUB_ENV
echo -e "$api_diff_output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "BREAKING_CHANGE_DETECTED=true" >> $GITHUB_ENV
else
echo "### ✅ No Public API Breaking Change detected" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "BREAKING_CHANGE_DETECTED=false" >> $GITHUB_ENV
fi

# Checkout to the branch associated with the pull request
git stash --include-untracked
git checkout ${{ github.head_ref }}

# Update the api-dump folder of the new version by making a commit if there are changes
for module in $modules; do
if ! diff "$NEW_API_DIR/${module}.json" "api-dump/${module}.json" > /dev/null; then
mv "$NEW_API_DIR/${module}.json" "api-dump/${module}.json"
fi
done

git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

# Check if there are changes in the api-dump folder
if ! git diff --quiet --exit-code -- api-dump/*.json; then
git add api-dump/*.json
git commit -m "Update API dumps for new version"
git push origin HEAD:${{ github.head_ref }}
else
echo "No changes to commit in the api-dump folder."
fi

git stash pop || true

- name: Comment on PR with API Diff
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const apiDiffOutput = process.env.API_DIFF_OUTPUT;
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

if (apiDiffOutput && apiDiffOutput.trim().length > 0) {
github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: issueNumber,
body: `## API Breakage Report\n${apiDiffOutput}\n`
});
} else {
console.log("No API diff output found.");
}

- name: Add Reviewer if Breaking Change Detected
if: env.BREAKING_CHANGE_DETECTED == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

// Define the list of potential reviewers
const potentialReviewers = ["rozayc", "rozayc", "rozayc", "rozayc", "rozayc"];

// Shuffle the array to ensure randomness
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}

// Shuffle the potential reviewers list
shuffle(potentialReviewers);

// Select the first 2 reviewers from the shuffled list
const selectedReviewers = potentialReviewers.slice(0, 1);

github.rest.pulls.requestReviewers({
owner: owner,
repo: repo,
pull_number: issueNumber,
reviewers: selectedReviewers
});
68 changes: 0 additions & 68 deletions .github/workflows/build_amplify_swift_platforms.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/build_minimum_supported_swift_platforms.yml

This file was deleted.

98 changes: 0 additions & 98 deletions .github/workflows/build_scheme.yml

This file was deleted.

Loading