Skip to content

Commit b80e86b

Browse files
authored
Merge pull request #158 from OpenSwiftUIProject/optimize/ci
Fix release 2021 CI build issue
2 parents 97dcc6c + 0df342f commit b80e86b

File tree

9 files changed

+100
-2
lines changed

9 files changed

+100
-2
lines changed

.github/workflows/ios.yml

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
OPENSWIFTUI_SWIFT_LOG: 0
2828
OPENSWIFTUI_SWIFT_CRYPTO: 0
2929
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
30+
OPENSWIFTUI_USE_LOCAL_DEPS: 1
31+
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
32+
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }}
33+
GH_TOKEN: ${{ github.token }}
3034
steps:
3135
- uses: actions/checkout@v4
3236
- name: Setup Xcode
@@ -35,6 +39,9 @@ jobs:
3539
xcode-version: ${{ matrix.xcode-version }}
3640
- name: Swift version
3741
run: swift --version
42+
- name: Set up build environment
43+
run: Scripts/CI/macOS_setup_build.sh
44+
shell: bash
3845
- name: Build test target in debug mode
3946
run: |
4047
xcodebuild build \

.github/workflows/macos.yml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
OPENSWIFTUI_SWIFT_LOG: 0
2424
OPENSWIFTUI_SWIFT_CRYPTO: 0
2525
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
26+
OPENSWIFTUI_USE_LOCAL_DEPS: 1
27+
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
28+
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }}
29+
GH_TOKEN: ${{ github.token }}
2630
steps:
2731
- uses: actions/checkout@v4
2832
- name: Setup Xcode
@@ -31,6 +35,9 @@ jobs:
3135
xcode-version: ${{ matrix.xcode-version }}
3236
- name: Swift version
3337
run: swift --version
38+
- name: Set up build environment
39+
run: Scripts/CI/macOS_setup_build.sh
40+
shell: bash
3441
- name: Build and run tests in debug mode with coverage
3542
run: |
3643
swift test \

Package.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
88
"state" : {
99
"branch" : "main",
10-
"revision" : "f2b16a1145acadd47c708d528f7eb1047d412f78"
10+
"revision" : "074491f9950c7692142630b08b7c87b8cb682e28"
1111
}
1212
},
1313
{

Scripts/CI/get_revision.sh

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# This script extracts the revision of a specific dependency from the Package.resolved file (Only support v3).
4+
# Usage: ./get_revision.sh <dependency_name>
5+
# Output: revision of the dependency
6+
7+
# A `realpath` alternative using the default C implementation.
8+
filepath() {
9+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
10+
}
11+
12+
REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
13+
cd $REPO_ROOT
14+
15+
# Ensure a dependency name is provided as an argument
16+
if [[ $# -lt 1 ]]; then
17+
echo "Usage: $0 <dependency_name>"
18+
exit 1
19+
fi
20+
21+
DEPENDENCY_NAME="$1"
22+
PACKAGE_RESOLVED_PATH="Package.resolved"
23+
24+
# Check if the Package.resolved file exists
25+
if [[ ! -f "$PACKAGE_RESOLVED_PATH" ]]; then
26+
echo "Error: $PACKAGE_RESOLVED_PATH file not found!"
27+
exit 1
28+
fi
29+
30+
# Extract the revision using jq
31+
REVISION=$(jq -r --arg name "$DEPENDENCY_NAME" '
32+
.pins[]?
33+
| select(.identity == $name)
34+
| .state.revision
35+
' "$PACKAGE_RESOLVED_PATH")
36+
37+
# Check if a revision was found
38+
if [[ -z "$REVISION" ]]; then
39+
echo "No revision found for dependency: $DEPENDENCY_NAME"
40+
exit 1
41+
else
42+
echo "$REVISION"
43+
fi

Scripts/CI/macOS_setup_build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# A `realpath` alternative using the default C implementation.
4+
filepath() {
5+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
6+
}
7+
8+
REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
9+
cd $REPO_ROOT
10+
11+
Scripts/CI/og_setup.sh

Scripts/CI/og_setup.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# A `realpath` alternative using the default C implementation.
4+
filepath() {
5+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
6+
}
7+
8+
REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
9+
10+
clone_checkout_og() {
11+
cd $REPO_ROOT
12+
revision=$(Scripts/CI/get_revision.sh opengraph)
13+
cd ..
14+
gh repo clone OpenSwiftUIProject/OpenGraph
15+
cd OpenGraph
16+
git checkout --quiet $revision
17+
}
18+
19+
update_og() {
20+
cd $REPO_ROOT/../OpenGraph
21+
./AG/update.sh
22+
}
23+
24+
clone_checkout_og
25+
update_og

Scripts/demangle.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ filepath() {
55
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
66
}
77

8-
OG_ROOT="$(dirname $(dirname $(filepath $0)))"
8+
REPO_ROOT="$(dirname $(dirname $(filepath $0)))"
9+
cd $REPO_ROOT
910

1011
# Get the language and input file path from the arguments
1112
language=${1:-"swift"}

Sources/OpenSwiftUICore/View/InterfaceIdiom/InterfaceIdiomPredicate.swift

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Audited for iOS 18.0
66
// Status: Complete
77

8+
#if OPENSWIFTUI_RELEASE_2024
89
package struct InterfaceIdiomPredicate<Idiom>: ViewInputPredicate where Idiom: InterfaceIdiom {
910
package init() {}
1011

@@ -42,3 +43,4 @@ extension AnyInterfaceIdiom {
4243
value == AnyInterfaceIdiom(pattern)
4344
}
4445
}
46+
#endif

Tests/OpenSwiftUICoreTests/View/InterfaceIdiom/InterfaceIdiomTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@testable import OpenSwiftUICore
66
import Testing
77

8+
#if OPENSWIFTUI_RELEASE_2024
89
struct InterfaceIdiomTests {
910
@Test
1011
func idiomEqual() {
@@ -35,3 +36,4 @@ struct InterfaceIdiomTests {
3536
#expect((WidgetInterfaceIdiom() ~= AnyInterfaceIdiom(.complication)) == false)
3637
}
3738
}
39+
#endif

0 commit comments

Comments
 (0)