Skip to content

Commit

Permalink
Cloak for macos fat binary ci/cd implemented
Browse files Browse the repository at this point in the history
[cloak]
  • Loading branch information
yaroslavyaroslav committed Feb 7, 2025
1 parent 9c90bdf commit 3cd3a3c
Showing 1 changed file with 60 additions and 86 deletions.
146 changes: 60 additions & 86 deletions .github/workflows/build_cloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push]


jobs:

Build-Cloak:
name: 'Build-Cloak'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,64 +51,65 @@ jobs:
mkdir ./release/plugin/linux
CGO_ENABLED=1 GOOS="linux" GOARCH="amd64" go build -v -o ./release/plugin/linux/ck-ovpn-plugin.a -buildmode=c-archive ./cmd/ck-ovpn-plugin/
mkdir ./release/plugin/windows
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS="windows" GOARCH="amd64" go build -v -o ./release/plugin/windows/ck-ovpn-plugin.dll -buildmode=c-shared ./cmd/ck-ovpn-plugin/
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS="windows" GOARCH="amd64" go build -v -o ./release/plugin/windows/ck-ovpn-plugin.dll -buildmode=c-shared ./cmd/ck-ovpn-plugin/
- name: Archive Linux client binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ck-client-linux
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-linux*'

- name: Archive Windows client binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ck-client-windows
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-windows*'

- name: Archive Darwin client binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ck-client-darwin
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-darwin*'

- name: Archive Linux server binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ck-server
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-server-linux*'

- name: Archive Plugin
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: desktop-plugin
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/plugin'

Build-Cloak-MacOS:
runs-on: macos-12
runs-on: macos-13
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[macos]') ||
contains(github.event.head_commit.message, '[cloak]')
name: "Build Cloak Desktop plugin"
name: "Build Cloak macOS plugin (fat)"
steps:

- name: Get Cloak
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: amnezia-vpn/Cloak
ref: master-amnezia
path: Cloak

# - name: 'Run build script'
# working-directory: Cloak
# run: |
# CGO_ENABLED=1 GOOS="darwin" GOARCH="amd64" go build -v -o ./release/plugin/darwin/ck-ovpn-plugin.a -buildmode=c-archive ./cmd/ck-ovpn-plugin/
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Build for x86_64
working-directory: Cloak
run: |
Expand All @@ -126,14 +126,15 @@ jobs:
lipo -create -output ./release/plugin/darwin/ck-ovpn-plugin.a \
./release/plugin/darwin/ck-ovpn-plugin-x86_64.a \
./release/plugin/darwin/ck-ovpn-plugin-arm64.a
- name: Archive artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: darwin-pt
name: ck-macos-plugin
path: Cloak/release/plugin

Build-Cloak-iOS:
runs-on: macos-12
runs-on: macos-13
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[ios]') ||
Expand All @@ -143,102 +144,75 @@ jobs:
steps:

- name: Get Cloak
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: amnezia-vpn/Cloak
ref: master-amnezia
path: Cloak

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: 'Run build script'
working-directory: Cloak
run: |
GOOS=ios GOARCH=arm64 GOFLAGS="-tags=ios" CGO_CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_ENABLED=1 go build -buildmode=c-archive -o ck-ovpn-plugin.a ./cmd/ck-ovpn-plugin
- name: Archive iOS client binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ck-ios-plugin
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/ck-ovpn-plugin*'

github-release:
name: GitHub Release
needs: Build-Cloak
needs: [Build-Cloak, Build-Cloak-iOS, Build-Cloak-MacOS]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Setup | Checkout
uses: actions/checkout@v2

- name: Setup | Artifacts
uses: actions/download-artifact@v2

- name: Setup | Checksums
run: for file in $(find ./ -name '*' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done

- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ck-client-linux.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ck-client-windows.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ck-client-darwin.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
uses: actions/checkout@v4

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ck-server.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Download all Artifacts
uses: actions/download-artifact@v4

- name: Upload binaries to release
- name: Generate Checksums for Cloak Artifacts
run: |
# List all artifact patterns you expect.
for path in ck-client-linux* ck-client-windows* ck-client-darwin* ck-server* ck-ios-plugin* ck-macos-plugin desktop-plugin; do
if [ -e "$path" ]; then
echo "Processing $path"
if [ -d "$path" ]; then
find "$path" -type f -exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
else
openssl dgst -sha256 -r "$path" > "$path.sha256"
fi
fi
done
- name: Zip artifacts individually
run: |
for artifact in ck-client-linux ck-client-windows ck-client-darwin ck-server ck-ios-plugin ck-macos-plugin desktop-plugin; do
if [ -d "$artifact" ]; then
echo "Zipping directory $artifact..."
zip -r "${artifact}.zip" "$artifact"
elif [ -f "$artifact" ]; then
echo "Zipping file $artifact..."
zip "${artifact}.zip" "$artifact"
fi
done
- name: List generated ZIP files
run: ls -l *.zip

- name: Upload ZIP archives to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ck-ios-plugin.zip
tag: ${{ github.ref }}
overwrite: true
file: "*.zip"
file_glob: true

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: darwin-pt.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: desktop-plugin.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

0 comments on commit 3cd3a3c

Please sign in to comment.