Skip to content

Commit 7021a12

Browse files
macos ci/cd added
[test_stuff]
1 parent 9583a9d commit 7021a12

File tree

1 file changed

+120
-66
lines changed

1 file changed

+120
-66
lines changed

.github/workflows/build_openvpnadapter_apple.yml

Lines changed: 120 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,121 @@ name: Build OpenVPNAdapter for Apple
33
on: [push]
44

55
jobs:
6-
build-ios:
7-
name: 'OpenVPNAdapter for iOS'
6+
build-macos:
7+
name: 'OpenVPNAdapter for macOS'
88
runs-on: macos-latest
99
if: |
1010
contains(github.event.head_commit.message, '[all]') ||
11-
contains(github.event.head_commit.message, '[ios]') ||
11+
contains(github.event.head_commit.message, '[macos]') ||
1212
contains(github.event.head_commit.message, '[openvpnadapter-ios]') ||
1313
contains(github.event.head_commit.message, '[openvpnadapter]')
14-
1514
steps:
1615
- name: Checkout code
1716
uses: actions/checkout@v4
1817
with:
18+
repository: amnezia-vpn/OpenVPNAdapter
19+
path: OpenVPNAdapter
20+
ref: macox-cicd
1921
submodules: recursive
2022

21-
- name: 'Get OpenVPNAdapter'
23+
- name: Configure amnezia.xcconfig
24+
run: |
25+
WORKINGDIR=$(pwd)
26+
echo "Configuring amnezia.xcconfig..."
27+
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
28+
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
29+
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
30+
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
31+
SKIP_INSTALL = NO
32+
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
33+
CODE_SIGNING_ALLOWED = NO
34+
CODE_SIGNING_REQUIRED = NO
35+
EOF
36+
37+
- name: Print macOS SDK Version
38+
run: |
39+
MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/')
40+
echo "Using macOS SDK version: $MACOSX_SDK"
41+
42+
- name: Build OpenVPNAdapter for macOS
43+
run: |
44+
echo "Building OpenVPNAdapter for macOS..."
45+
xcrun xcodebuild \
46+
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
47+
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
48+
-scheme OpenVPNAdapter \
49+
-destination 'generic/platform=macOS' \
50+
-configuration Release \
51+
-sdk macosx
52+
53+
- name: Generate Checksums for OpenVPNAdapter.framework
54+
run: |
55+
export WORKINGDIR=`pwd`
56+
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework" ]; then
57+
echo "Generating checksums for OpenVPNAdapter.framework..."
58+
find $WORKINGDIR/OpenVPNAdapter/build/Release-macos \
59+
-type f \
60+
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
61+
else
62+
echo "Directory $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework does not exist."
63+
exit 1
64+
fi
65+
66+
- name: Archive Build
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: OpenVPNAdapter-macos
70+
path: 'OpenVPNAdapter/build/Release-macos'
71+
72+
build-ios:
73+
name: 'OpenVPNAdapter for iOS'
74+
runs-on: macos-latest
75+
if: |
76+
contains(github.event.head_commit.message, '[all]') ||
77+
contains(github.event.head_commit.message, '[ios]') ||
78+
contains(github.event.head_commit.message, '[openvpnadapter-ios]') ||
79+
contains(github.event.head_commit.message, '[openvpnadapter]')
80+
81+
steps:
82+
- name: Get OpenVPNAdapter
2283
uses: actions/checkout@v4
2384
with:
2485
repository: amnezia-vpn/OpenVPNAdapter
25-
ref: master-amnezia
86+
ref: macox-cicd
2687
path: OpenVPNAdapter
2788
submodules: recursive
2889

2990
- name: Configure amnezia.xcconfig
3091
run: |
31-
export WORKINGDIR=`pwd`
92+
WORKINGDIR=$(pwd)
3293
echo "Configuring amnezia.xcconfig..."
33-
cat $WORKINGDIR/OpenVPNAdapter/Configuration/Project.xcconfig > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
34-
cat << EOF >> $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
94+
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
3595
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
3696
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
3797
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
98+
SKIP_INSTALL = NO
99+
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
100+
CODE_SIGNING_ALLOWED = NO
101+
CODE_SIGNING_REQUIRED = NO
38102
EOF
39103
40104
- name: Build OpenVPNAdapter for iOS
41105
run: |
42-
export SDK_PATH=`xcrun --sdk iphoneos --show-sdk-path`
43-
export CLANG=`xcrun --sdk iphoneos --find clang`
44-
export XCODEBUILD="/usr/bin/xcodebuild"
45-
46-
cd OpenVPNAdapter
47-
$XCODEBUILD -scheme OpenVPNAdapter \
48-
-configuration Release \
49-
-xcconfig Configuration/amnezia.xcconfig \
50-
-sdk iphoneos \
106+
echo "Building OpenVPNAdapter for iOS..."
107+
xcrun xcodebuild \
108+
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
109+
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
110+
-scheme OpenVPNAdapter \
51111
-destination 'generic/platform=iOS' \
52-
-project OpenVPNAdapter.xcodeproj \
53-
CODE_SIGNING_ALLOWED=NO
54-
55-
# With CODE_SIGNING_ALLOWED=NO this part is redundant, but it's not just signatures are being deleted here,
56-
# It's also dependant frameworks and debug symbols.
57-
- name: Remove CodeSignature
58-
run: |
59-
export WORKINGDIR=`pwd`
60-
echo "Removing CodeSignature if exists..."
61-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework/Versions/A/_CodeSignature
62-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework/Versions/Current/_CodeSignature
63-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/LZ4.framework
64-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNClient.framework
65-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/mbedTLS.framework
66-
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework.dSYM
112+
-configuration Release \
113+
-sdk iphoneos
67114
68115
- name: Generate Checksums for OpenVPNAdapter.framework
69116
run: |
70117
export WORKINGDIR=`pwd`
71118
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework" ]; then
72119
echo "Generating checksums for OpenVPNAdapter.framework..."
73-
find $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework \
120+
find $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos \
74121
-type f \
75122
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
76123
else
@@ -86,38 +133,45 @@ jobs:
86133

87134
github-release:
88135
name: GitHub Release
89-
needs: [build-ios]
136+
needs: [build-ios, build-macos]
90137
runs-on: ubuntu-latest
91138
if: startsWith(github.ref, 'refs/tags/')
92-
93139
steps:
94-
- name: Setup | Checkout
95-
uses: actions/checkout@v4
96-
97-
- name: Setup | Download iOS Artifact
98-
uses: actions/download-artifact@v4
99-
with:
100-
name: OpenVPNAdapter-ios
101-
path: openvpnadapter-ios/
102-
103-
- name: Create Combined Folder
104-
run: |
105-
mkdir -p openvpnadapter
106-
cp -r openvpnadapter-ios/ openvpnadapter/
107-
108-
- name: Zip Combined Artifacts
109-
run: |
110-
zip -r openvpnadapter.zip openvpnadapter/
111-
shell: bash
112-
113-
- name: List Generated Files
114-
run: ls -l
115-
116-
- name: Upload Binaries to GitHub Release
117-
uses: svenstaro/upload-release-action@v2
118-
with:
119-
repo_token: ${{ secrets.GITHUB_TOKEN }}
120-
tag: ${{ github.ref }}
121-
overwrite: true
122-
file: openvpnadapter.zip
123-
file_glob: false
140+
- name: Setup | Checkout
141+
uses: actions/checkout@v4
142+
143+
- name: Download iOS Artifact
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: OpenVPNAdapter-ios
147+
path: openvpnadapter-ios/
148+
149+
- name: Download macOS Artifact
150+
uses: actions/download-artifact@v4
151+
with:
152+
name: OpenVPNAdapter-macos
153+
path: openvpnadapter-macos/
154+
155+
- name: Create Combined Folder
156+
run: |
157+
mkdir -p openvpnadapter/ios
158+
mkdir -p openvpnadapter/macos
159+
cp -r openvpnadapter-ios/* openvpnadapter/ios/
160+
cp -r openvpnadapter-macos/* openvpnadapter/macos/
161+
162+
- name: Zip Combined Artifacts
163+
run: |
164+
zip -r openvpnadapter.zip openvpnadapter/
165+
shell: bash
166+
167+
- name: List Generated Files
168+
run: ls -l
169+
170+
- name: Upload Binaries to GitHub Release
171+
uses: svenstaro/upload-release-action@v2
172+
with:
173+
repo_token: ${{ secrets.GITHUB_TOKEN }}
174+
tag: ${{ github.ref }}
175+
overwrite: true
176+
file: openvpnadapter.zip
177+
file_glob: false

0 commit comments

Comments
 (0)