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

Fix release 2021 CI build issue #158

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -35,6 +39,9 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/macOS_setup_build.sh
shell: bash
- name: Build test target in debug mode
run: |
xcodebuild build \
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -31,6 +35,9 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/macOS_setup_build.sh
shell: bash
- name: Build and run tests in debug mode with coverage
run: |
swift test \
Expand Down
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "f2b16a1145acadd47c708d528f7eb1047d412f78"
"revision" : "074491f9950c7692142630b08b7c87b8cb682e28"
}
},
{
Expand Down
43 changes: 43 additions & 0 deletions Scripts/CI/get_revision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# This script extracts the revision of a specific dependency from the Package.resolved file (Only support v3).
# Usage: ./get_revision.sh <dependency_name>
# Output: revision of the dependency

# A `realpath` alternative using the default C implementation.
filepath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
cd $REPO_ROOT

# Ensure a dependency name is provided as an argument
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <dependency_name>"
exit 1
fi

DEPENDENCY_NAME="$1"
PACKAGE_RESOLVED_PATH="Package.resolved"

# Check if the Package.resolved file exists
if [[ ! -f "$PACKAGE_RESOLVED_PATH" ]]; then
echo "Error: $PACKAGE_RESOLVED_PATH file not found!"
exit 1
fi

# Extract the revision using jq
REVISION=$(jq -r --arg name "$DEPENDENCY_NAME" '
.pins[]?
| select(.identity == $name)
| .state.revision
' "$PACKAGE_RESOLVED_PATH")

# Check if a revision was found
if [[ -z "$REVISION" ]]; then
echo "No revision found for dependency: $DEPENDENCY_NAME"
exit 1
else
echo "$REVISION"
fi
11 changes: 11 additions & 0 deletions Scripts/CI/macOS_setup_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# A `realpath` alternative using the default C implementation.
filepath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
cd $REPO_ROOT

Scripts/CI/og_setup.sh
25 changes: 25 additions & 0 deletions Scripts/CI/og_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# A `realpath` alternative using the default C implementation.
filepath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"

clone_checkout_og() {
cd $REPO_ROOT
revision=$(Scripts/CI/get_revision.sh opengraph)
cd ..
gh repo clone OpenSwiftUIProject/OpenGraph
cd OpenGraph
git checkout --quiet $revision
}

update_og() {
cd $REPO_ROOT/../OpenGraph
./AG/update.sh
}

clone_checkout_og
update_og
3 changes: 2 additions & 1 deletion Scripts/demangle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ filepath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

OG_ROOT="$(dirname $(dirname $(filepath $0)))"
REPO_ROOT="$(dirname $(dirname $(filepath $0)))"
cd $REPO_ROOT

# Get the language and input file path from the arguments
language=${1:-"swift"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Audited for iOS 18.0
// Status: Complete

#if OPENSWIFTUI_RELEASE_2024
package struct InterfaceIdiomPredicate<Idiom>: ViewInputPredicate where Idiom: InterfaceIdiom {
package init() {}

Expand Down Expand Up @@ -42,3 +43,4 @@ extension AnyInterfaceIdiom {
value == AnyInterfaceIdiom(pattern)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@testable import OpenSwiftUICore
import Testing

#if OPENSWIFTUI_RELEASE_2024
struct InterfaceIdiomTests {
@Test
func idiomEqual() {
Expand Down Expand Up @@ -35,3 +36,4 @@ struct InterfaceIdiomTests {
#expect((WidgetInterfaceIdiom() ~= AnyInterfaceIdiom(.complication)) == false)
}
}
#endif
Loading