Skip to content

Commit

Permalink
Improve documentation (#60)
Browse files Browse the repository at this point in the history
* updating/fixing documentation

* Update README.md

---------

Co-authored-by: Alex Guretzki <[email protected]>
  • Loading branch information
goergisn and Alex Guretzki authored Nov 19, 2024
1 parent 94b8873 commit 8748bac
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
62 changes: 62 additions & 0 deletions Examples/github-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 👀 Detect public API changes

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
new:
description: 'Branch/tag of the new/updated version'
required: true
old:
description: 'Branch/tag of the old/comparison version'
required: true

jobs:

build:
runs-on: macos-14

steps:
- uses: actions/checkout@v4

- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'

- name: 🚚 Fetch repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 👾 Define Diff Versions
run: |
NEW="${{ env.source }}~${{ env.githubRepo }}"
# Release branches get compared to the last tag instead of the target branch
if [[ '${{ github.head_ref || env.noTargetBranch }}' == release/* ]]
then
LATEST_TAG=$(git describe --tags --abbrev=0)
OLD="$LATEST_TAG~${{ env.githubRepo }}"
else
OLD="${{ env.target }}~${{ env.githubRepo }}"
fi
# Providing the output to the environment
echo "OLD_VERSION=$OLD" >> $GITHUB_ENV
echo "NEW_VERSION=$NEW" >> $GITHUB_ENV
env:
source: '${{ github.event.inputs.new || github.head_ref }}'
target: '${{ github.event.inputs.old || github.event.pull_request.base.ref }}'
githubRepo: '${{github.server_url}}/${{github.repository}}.git'
noTargetBranch: 'no target branch'

# The github action automatically posts on a PR
# and/or outputs the diff to the $GITHUB_STEP_SUMMARY
- name: 🔍 Detect Changes
uses: Adyen/[email protected]
with:
platform: "iOS"
new: ${{ env.NEW_VERSION }}
old: ${{ env.OLD_VERSION }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ swift build --configuration release
--old "old/path/to/project.framework"
```

## Github Action
The public-api-diff can be used easily via the provided github action, which creates a comment on a PR (if applicable) and also adds it to the Github step summary.
```bash
- name: 🔍 Detect Changes
uses: Adyen/[email protected]
with:
platform: "iOS"
new: "develop~https://github.com/Adyen/adyen-ios.git"
old: "5.12.0~https://github.com/Adyen/adyen-ios.git"
```
See: [example workflow](https://github.com/Adyen/adyen-swift-public-api-diff/blob/main/Examples/github-workflow.yml)

## Alternatives
- **swift-api-digester**
- `xcrun swift-api-digester -dump-sdk`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ let newSource: ProjectSource = try .from("some/local/path")

let projectBuilder = ProjectBuilder(
projectType: .swiftPackage, // .xcodeProject("scheme_name")
swiftInterfaceType: .public // .private
platform: .iOS, // .macOS
swiftInterfaceType: .public // .private / .package
)

let projectBuilderResult: ProjectBuilder.Result = try await projectBuilder.build(
Expand Down

0 comments on commit 8748bac

Please sign in to comment.