Skip to content

Commit

Permalink
Refactor Android AWG build script (#1)
Browse files Browse the repository at this point in the history
[android-awg]
  • Loading branch information
albexk authored Feb 12, 2024
1 parent 05defb7 commit cf2cdb5
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 455 deletions.
92 changes: 35 additions & 57 deletions .github/workflows/build_awg_android.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: android-awg

on: [push]


jobs:

Expand All @@ -15,59 +14,39 @@ jobs:
contains(github.event.head_commit.message, '[awg]')
steps:

- name: 'Setup Java'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: 'Setup Android'
run: |
export NDK_VERSION=23c
export ANDROID_NDK_PLATFORM=android-23
export ANDROID_NDK_HOME=${{ runner.temp }}/android-ndk-r${NDK_VERSION}
export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME
export ANDROID_CURRENT_ARCH=${{ matrix.arch }}
if [ ! -f $ANDROID_NDK_ROOT/ndk-build ]; then
wget https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux.zip -qO ${{ runner.temp }}/ndk.zip &&
unzip -q -d ${{ runner.temp }} ${{ runner.temp }}/ndk.zip ;
fi
- name: 'Install GO'
uses: actions/setup-go@v2
- name: 'Setup Android NDK'
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
go-version: 1.20.3
ndk-version: 'r26b'

- name: 'Setup ccache'
uses: hendrikmuhs/ccache-action@v1.2

- name: 'Get sources'
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 10

- name: 'Get Wireguard'
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 'Get AmneziaWG'
uses: actions/checkout@v4
with:
repository: amnezia-vpn/amneziawg-android
ref: master
path: android/wireguard-android
path: android/amneziawg-android
submodules: true

- name: 'Build Wireguard binary'
working-directory: android/wireguard-android
run: |
git submodule update --init --recursive
echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"
./gradlew assembleRelease
- name: 'Build AmneziaWG binary'
working-directory: android/amneziawg-android
run: ./gradlew :tunnel:stripReleaseDebugSymbols

- name: Archive artifacts
uses: actions/upload-artifact@v3
- name: 'Archive artifacts'
uses: actions/upload-artifact@v4
with:
name: wg-android
path: android/wireguard-android/tunnel/build/intermediates/stripped_native_libs/release/out/lib/*
name: awg-android
path: android/amneziawg-android/tunnel/build/intermediates/stripped_native_libs/release/out/lib/*

github-release:
name: GitHub Release
Expand All @@ -76,24 +55,23 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')

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

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

- name: Setup | Checksums
run: for file in $(find ./ -name '*.so' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Setup | Checksums
run: for file in $(find ./ -name '*.so' ); 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: awg-android.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- 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: awg-android.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
70 changes: 36 additions & 34 deletions .github/workflows/build_awg_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: awg-ios
on: [push]

jobs:

Build-WG-iOS:
name: 'AmneziaWG for iOS'
runs-on: macos-12
if: |
contains(github.event.head_commit.message, '[all]') ||
Expand All @@ -15,27 +17,27 @@ jobs:
arch: [arm64]

steps:
- name: Install dependencies
run: brew install swiftlint
- name: 'Install dependencies'
run: brew install swiftlint

- name: Get WireGuard
uses: actions/checkout@v3
with:
repository: amnezia-vpn/amneziawg-apple
ref: master
path: awg-apple
- name: 'Get AmneziaWG'
uses: actions/checkout@v4
with:
repository: amnezia-vpn/amneziawg-apple
ref: master
path: awg-apple

- name: Build WG
working-directory: awg-apple/Sources/WireGuardKitGo
run: ARCHS=${{ matrix.arch }} PLATFORM_NAME=iphoneos make
- name: 'Build WG'
working-directory: awg-apple/Sources/WireGuardKitGo
run: ARCHS=${{ matrix.arch }} PLATFORM_NAME=iphoneos make

- name: Upload Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: awg-ios-${{ matrix.arch }}
path: ${{ github.workspace }}/awg-apple/Sources/WireGuardKitGo/out
if-no-files-found: error
retention-days: 7
- name: 'Archive artifacts'
uses: actions/upload-artifact@v4
with:
name: awg-ios-${{ matrix.arch }}
path: ${{ github.workspace }}/awg-apple/Sources/WireGuardKitGo/out
if-no-files-found: error
retention-days: 7

github-release:
name: GitHub Release
Expand All @@ -44,23 +46,23 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')

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

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

- name: Setup | Checksums
run: for file in $(find ./ -name '*.a' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Setup | Checksums
run: for file in $(find ./ -name '*.a' ); 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: 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: "*.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: "*.zip"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
84 changes: 41 additions & 43 deletions .github/workflows/build_awg_linux.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
name: linux-awg

on: [push]

jobs:

Build-AWG-Linux:
name: 'AmneziaWG for Linux'
runs-on: ubuntu-20.04
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[linux]') ||
contains(github.event.head_commit.message, '[linux-awg]') ||
contains(github.event.head_commit.message, '[awg]')
name: "WireGuard for Linux"
steps:

- name: 'Get Amnezia WireGuard'
uses: actions/checkout@v3
with:
repository: amnezia-vpn/amneziawg-go
ref: master
path: amnezia-wg

- name: 'Run build script'
working-directory: amnezia-wg
run: |
make
./wireguard-go --version
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: awg-linux
path: amnezia-wg/wireguard-go
- name: 'Get AmneziaWG'
uses: actions/checkout@v4
with:
repository: amnezia-vpn/amneziawg-go
ref: master
path: amneziawg-go

- name: 'Run build script'
working-directory: amneziawg-go
run: |
make
./amneziawg-go --version
- name: 'Archive artifacts'
uses: actions/upload-artifact@v4
with:
name: awg-linux
path: amneziawg-go/amneziawg-go

github-release:
name: GitHub Release
Expand All @@ -42,24 +41,23 @@ jobs:
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: awg-linux.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

- name: Setup | Checkout
uses: actions/checkout@v4

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

- 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: awg-linux.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
Loading

0 comments on commit cf2cdb5

Please sign in to comment.