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

refactor: simplify OpenVPNAdapter build workflow by removing unnecess… #21

Merged
merged 1 commit into from
Feb 16, 2025
Merged
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
102 changes: 45 additions & 57 deletions .github/workflows/build_openvpnadapter_apple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,43 @@ jobs:
ref: master-amnezia
submodules: recursive

- name: Configure amnezia.xcconfig
run: |
WORKINGDIR=$(pwd)
echo "Configuring amnezia.xcconfig…"
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
SKIP_INSTALL = NO
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
CODE_SIGNING_ALLOWED = NO
CODE_SIGNING_REQUIRED = NO
EOF

- name: Print macOS SDK Version
run: |
MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/')
echo "Using macOS SDK version: $MACOSX_SDK"

- name: Build OpenVPNAdapter for macOS
run: |
echo "Building OpenVPNAdapter for macOS…"
xcrun xcodebuild \
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
-scheme OpenVPNAdapter \
-destination 'generic/platform=macOS' \
-configuration Release \
-sdk macosx
-sdk macosx \
PROJECT_TEMP_DIR=$(pwd)/OpenVPNAdapter/build/OpenVPNAdapter.build \
CONFIGURATION_BUILD_DIR=$(pwd)/OpenVPNAdapter/build/Release-macos \
BUILT_PRODUCTS_DIR=$(pwd)/OpenVPNAdapter/build/Release-macos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO

- name: Generate Checksums for OpenVPNAdapter.framework
run: |
export WORKINGDIR=`pwd`
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework" ]; then
if [ -d "$(pwd)/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework" ]; then
echo "Generating checksums for OpenVPNAdapter.framework…"
find $WORKINGDIR/OpenVPNAdapter/build/Release-macos \
find $(pwd)/OpenVPNAdapter/build/Release-macos \
-type f \
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
else
echo "Directory $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework does not exist."
echo "Directory $(pwd)/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework does not exist."
exit 1
fi

- name: Archive Build
- name: Create tarball preserving symlinks
run: tar -cvf OpenVPNAdapter-macos.tar -C OpenVPNAdapter/build/Release-macos .

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: OpenVPNAdapter-macos
path: 'OpenVPNAdapter/build/Release-macos'
path: OpenVPNAdapter-macos.tar

build-ios:
name: 'OpenVPNAdapter for iOS'
Expand All @@ -87,49 +76,42 @@ jobs:
path: OpenVPNAdapter
submodules: recursive

- name: Configure amnezia.xcconfig
run: |
WORKINGDIR=$(pwd)
echo "Configuring amnezia.xcconfig…"
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
SKIP_INSTALL = NO
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
CODE_SIGNING_ALLOWED = NO
CODE_SIGNING_REQUIRED = NO
EOF

- name: Build OpenVPNAdapter for iOS
run: |
echo "Building OpenVPNAdapter for iOS…"
xcrun xcodebuild \
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
-scheme OpenVPNAdapter \
-destination 'generic/platform=iOS' \
-configuration Release \
-sdk iphoneos
-sdk iphoneos \
PROJECT_TEMP_DIR=$(pwd)/OpenVPNAdapter/build/OpenVPNAdapter.build \
CONFIGURATION_BUILD_DIR=$(pwd)/OpenVPNAdapter/build/Release-iphoneos \
BUILT_PRODUCTS_DIR=$(pwd)/OpenVPNAdapter/build/Release-iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO

- name: Generate Checksums for OpenVPNAdapter.framework
run: |
export WORKINGDIR=`pwd`
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework" ]; then
if [ -d "$(pwd)/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework" ]; then
echo "Generating checksums for OpenVPNAdapter.framework…"
find $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos \
-type f \
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
find "$(pwd)/OpenVPNAdapter/build/Release-iphoneos" -type f -exec sh -c \
'if [ ! -L "$1" ]; then openssl dgst -sha256 -r "$1" > "$1.sha256"; fi' _ {} \;
else
echo "Directory $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework does not exist."
echo "Directory $(pwd)/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework does not exist."
exit 1
fi

- name: Archive Build
- name: Create tarball preserving symlinks
run: tar -cvf OpenVPNAdapter-ios.tar -C OpenVPNAdapter/build/Release-iphoneos .

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: OpenVPNAdapter-ios
path: 'OpenVPNAdapter/build/Release-iphoneos'
path: OpenVPNAdapter-ios.tar

github-release:
name: GitHub Release
Expand All @@ -146,22 +128,28 @@ jobs:
name: OpenVPNAdapter-ios
path: openvpnadapter-ios/

- name: Extract iOS Artifact
run: tar -xvf openvpnadapter-ios/OpenVPNAdapter-ios.tar -C openvpnadapter-ios/

- name: Download macOS Artifact
uses: actions/download-artifact@v4
with:
name: OpenVPNAdapter-macos
path: openvpnadapter-macos/

- name: Extract macOS Artifact
run: tar -xvf openvpnadapter-macos/OpenVPNAdapter-macos.tar -C openvpnadapter-macos/

- name: Create Combined Folder
run: |
mkdir -p openvpnadapter/ios
mkdir -p openvpnadapter/macos
cp -r openvpnadapter-ios/* openvpnadapter/ios/
cp -r openvpnadapter-macos/* openvpnadapter/macos/
rsync -a openvpnadapter-ios/ openvpnadapter/ios/
rsync -a openvpnadapter-macos/ openvpnadapter/macos/

- name: Zip Combined Artifacts
- name: Archive using tar
run: |
zip -r openvpnadapter.zip openvpnadapter/
tar -czf openvpnadapter.tar.gz openvpnadapter/
shell: bash

- name: List Generated Files
Expand All @@ -173,5 +161,5 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file: openvpnadapter.zip
file_glob: false
file: openvpnadapter.tar.gz
file_glob: false