From 4cdc0d937471542dd59b1d4f440309c9e1951ba2 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Thu, 19 Dec 2024 13:52:20 +0100 Subject: [PATCH 1/4] Updated action.yml --- .github/maven-action/action.yml | 5 ++--- webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/maven-action/action.yml b/.github/maven-action/action.yml index c8457abd..7912831e 100644 --- a/.github/maven-action/action.yml +++ b/.github/maven-action/action.yml @@ -53,10 +53,9 @@ runs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_TOKEN - settings-path: ${{ github.workspace }}/.github/workflows - name: Build - run: mvn package -DskipTests -s .github/workflows/settings.xml + run: mvn package -DskipTests shell: bash - name: Test @@ -67,5 +66,5 @@ runs: env: MAVEN_USERNAME: ${{ inputs.maven-username }} MAVEN_TOKEN: ${{ inputs.maven-password }} - run: mvn deploy -DskipTests -s .github/workflows/settings.xml + run: mvn deploy -DskipTests shell: bash diff --git a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt index c3f4c031..d6724d9d 100644 --- a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt +++ b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt @@ -1,8 +1,10 @@ cmake_minimum_required(VERSION 3.13) project(webrtc) -# Used for Linux sysroot installation -find_package(Python3 REQUIRED COMPONENTS Interpreter) +if(LINUX) + # Used for Linux sysroot installation + find_package(Python3 REQUIRED COMPONENTS Interpreter) +endif() FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pseudo.hxx "template class pseudo{}\n") From a51d3e8ff9f8092dae4d31e0b181968e49f8e8ae Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Thu, 19 Dec 2024 18:17:54 +0100 Subject: [PATCH 2/4] Fixed action build maven credentials --- .github/maven-action/action.yml | 7 +++++-- .github/workflows/build.yml | 14 ++++++++++---- .github/workflows/settings.xml | 15 --------------- 3 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/settings.xml diff --git a/.github/maven-action/action.yml b/.github/maven-action/action.yml index 7912831e..67244705 100644 --- a/.github/maven-action/action.yml +++ b/.github/maven-action/action.yml @@ -12,11 +12,11 @@ inputs: description: 'The target platform.' required: true - gpg-key: + maven-gpg-private-key: description: 'The GPG private key to sign Maven artifacts.' required: true - gpg-pass: + maven-gpg-passphrase: description: 'The GPG passphrase for the GPG key.' required: true @@ -53,6 +53,8 @@ runs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_TOKEN + gpg-private-key: ${{ inputs.maven-gpg-private-key }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Build run: mvn package -DskipTests @@ -66,5 +68,6 @@ runs: env: MAVEN_USERNAME: ${{ inputs.maven-username }} MAVEN_TOKEN: ${{ inputs.maven-password }} + MAVEN_GPG_PASSPHRASE: ${{ inputs.maven-gpg-passphrase }} run: mvn deploy -DskipTests shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63f5063e..632f0625 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,7 +73,9 @@ jobs: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_PASSWORD }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} build-linux: strategy: @@ -127,7 +129,9 @@ jobs: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_PASSWORD }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} build-macos: strategy: @@ -153,7 +157,7 @@ jobs: brew install python-setuptools - name: Select Xcode version - run: sudo xcode-select -s /Applications/Xcode_14.3.1.app/Contents/Developer + run: sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer - id: maven-build name: Maven build @@ -162,4 +166,6 @@ jobs: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_PASSWORD }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/settings.xml b/.github/workflows/settings.xml deleted file mode 100644 index 602739e2..00000000 --- a/.github/workflows/settings.xml +++ /dev/null @@ -1,15 +0,0 @@ - - false - - - build-properties - - true - - - ${env.WEBRTC_CHECKOUT_FOLDER} - ${env.WEBRTC_INSTALL_FOLDER} - - - - \ No newline at end of file From 91b185603e0117f41c726585f696f3753d7f3216 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Sun, 22 Dec 2024 16:08:21 +0100 Subject: [PATCH 3/4] Build and release actions and workflows --- .github/actions/build/action.yml | 62 +++++ .../release}/action.yml | 6 +- .github/workflows/build.yml | 12 +- .github/workflows/release.yml | 235 ++++++++++++++---- 4 files changed, 253 insertions(+), 62 deletions(-) create mode 100644 .github/actions/build/action.yml rename .github/{maven-action => actions/release}/action.yml (93%) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 00000000..abaeb602 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,62 @@ +name: 'Maven Build' + +description: 'Build the platform dependent Java library' + +inputs: + java-version: + description: 'The Java build version.' + required: true + default: '17' + + platform-name: + description: 'The target platform.' + required: true + + maven-username: + description: 'The Maven username.' + required: true + + maven-password: + description: 'The Maven password.' + required: true + +runs: + using: "composite" + steps: + - name: Set up WebRTC cache + uses: actions/cache@v4 + with: + path: ~/${{ env.WEBRTC_INSTALL_FOLDER }} + key: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ inputs.platform-name }}-${{ hashFiles('webrtc-jni/pom.xml') }} + restore-keys: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ inputs.platform-name }}- + + - name: Set up Maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: maven-${{ inputs.platform-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-${{ inputs.platform-name }}- + + - name: Set up JDK ${{ inputs.java-version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.java-version }} + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + + - name: Build + run: mvn package -DskipTests + shell: bash + + - name: Test + run: mvn -B jar:jar surefire:test + shell: bash + + - name: Deploy + env: + MAVEN_USERNAME: ${{ inputs.maven-username }} + MAVEN_TOKEN: ${{ inputs.maven-password }} + run: mvn deploy -DskipTests + shell: bash diff --git a/.github/maven-action/action.yml b/.github/actions/release/action.yml similarity index 93% rename from .github/maven-action/action.yml rename to .github/actions/release/action.yml index 67244705..399ecb5f 100644 --- a/.github/maven-action/action.yml +++ b/.github/actions/release/action.yml @@ -1,6 +1,6 @@ -name: 'Maven Build' +name: 'Maven Release' -description: 'Build the platform dependent Java library' +description: 'Release the platform dependent Java library' inputs: java-version: @@ -69,5 +69,5 @@ runs: MAVEN_USERNAME: ${{ inputs.maven-username }} MAVEN_TOKEN: ${{ inputs.maven-password }} MAVEN_GPG_PASSPHRASE: ${{ inputs.maven-gpg-passphrase }} - run: mvn deploy -DskipTests + run: mvn deploy -Prelease -DskipTests shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 632f0625..cde29762 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,14 +68,12 @@ jobs: - id: maven-build name: Maven build - uses: ./.github/maven-action + uses: ./.github/actions/build with: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} maven-password: ${{ secrets.MAVEN_TOKEN }} - maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} build-linux: strategy: @@ -124,14 +122,12 @@ jobs: - id: maven-build name: Maven build - uses: ./.github/maven-action + uses: ./.github/actions/build with: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} maven-password: ${{ secrets.MAVEN_TOKEN }} - maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} build-macos: strategy: @@ -161,11 +157,9 @@ jobs: - id: maven-build name: Maven build - uses: ./.github/maven-action + uses: ./.github/actions/build with: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} maven-password: ${{ secrets.MAVEN_TOKEN }} - maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c80e8856..4e83d0b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,78 +5,213 @@ on: tags: - 'v*' workflow_dispatch: + inputs: + developmentVersion: + description: "Default version to use for new local working copy." + required: true + default: "X.Y.Z-SNAPSHOT" + +env: + WEBRTC_CACHE_BRANCH: 4844 + WEBRTC_CHECKOUT_FOLDER: webrtc + WEBRTC_INSTALL_FOLDER: webrtc/build jobs: - release: - runs-on: [self-hosted, "${{ matrix.os }}"] + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Checkout code + uses: actions/checkout@v4 + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" + mvn release:prepare -DskipTests -DpushChanges=false -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} + git push + git push --tags + build-windows: + needs: prepare-release strategy: + fail-fast: false matrix: - os: [ubuntu-20.04, macos-13, windows-2022] + platform: + - name: windows_x86_64 + runs-on: windows-2019 java: [17] + runs-on: ${{ matrix.platform.runs-on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 - env: - WEBRTC_CACHE_BRANCH: 4844 - WEBRTC_CHECKOUT_FOLDER: webrtc - WEBRTC_INSTALL_FOLDER: webrtc/build + - name: Set up Python 3.11 + if: false + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Disk cleanup + if: false + run: | + Get-PSDrive + # Docker Images + docker rmi $(docker images -q -a) + # Android SDK + if ($Env:ANDROID_HOME) { + Remove-Item -Recurse -Force $Env:ANDROID_HOME -ErrorAction Ignore + } + if ($Env:ANDROID_NDK_HOME) { + Remove-Item -Recurse -Force $Env:ANDROID_NDK_HOME -ErrorAction Ignore + } + # JVM + if ($Env:JAVA_HOME_11_X64) { + Remove-Item -Recurse -Force $Env:JAVA_HOME_11_X64 -ErrorAction Ignore + } + if ($Env:JAVA_HOME_8_X64) { + Remove-Item -Recurse -Force $Env:JAVA_HOME_8_X64 -ErrorAction Ignore + } + Get-PSDrive + - name: Install required packages + run: | + choco install ninja + + - id: maven-build + name: Maven build + uses: ./.github/actions/release + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + build-linux: + needs: prepare-release + strategy: + fail-fast: false + matrix: + platform: + - name: linux_x86-64 + runs-on: ubuntu-20.04 + java: [17] + runs-on: ${{ matrix.platform.runs-on }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Get tag from current branch + id: tag-selector + run: | + git fetch -a + tag=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "tag=$tag" >> "$GITHUB_OUTPUT" + git checkout $tag - - name: Set up Linux audio system - if: runner.os == 'Linux' + - name: Disk cleanup + run: | + set -x + df -h + #sudo du -h -d1 /usr/local + #sudo du -h -d1 /usr/local/share + #sudo du -h -d1 /usr/local/lib + #sudo du -h -d1 /usr/share + RMI=`docker images -q -a` + if [ -n "$RMI" ]; then + docker rmi $RMI + fi + # 4.6G + sudo rm -rf /usr/local/.ghcup + # 1.7G + sudo rm -rf /usr/share/swift + # 1.4G + sudo rm -rf /usr/share/dotnet + # 13G + sudo rm -rf /usr/local/lib/android + df -h + + - name: Install required packages run: | sudo apt-get update - sudo apt-get install -y pulseaudio libpulse-dev libasound2-dev libudev-dev libv4l-dev + sudo apt-get install -y pulseaudio libpulse-dev libasound2-dev libdbus-1-dev libudev-dev libv4l-dev libx11-dev binutils cmake git locales lsb-release ninja-build pkg-config python3 python3-setuptools rsync unzip wget xz-utils # Required for testing pulseaudio --start + #sudo apt-get install -y pipewire pipewire-pulse gstreamer1.0-pipewire libspa-0.2-bluetooth libspa-0.2-jack pipewire-audio-client-libraries + #systemctl --user daemon-reload + #systemctl --user --now enable pipewire{,-pulse}.{socket,service} - - name: Set up WebRTC cache - uses: actions/cache@v1 - with: - path: ~/${{ env.WEBRTC_INSTALL_FOLDER }} - key: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}-${{ hashFiles('webrtc-jni/pom.xml') }} - restore-keys: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}- - - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} - restore-keys: maven-${{ runner.os }}- - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - server-id: ossrh - server-username: NEXUS_USERNAME - server-password: NEXUS_PASSWORD - settings-path: ${{ github.workspace }}/.github/workflows - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg-passphrase: GPG_PASSPHRASE - - - name: Create Release - if: runner.os == 'Linux' # Create release only once + - name: Create Release # Create the release only once on Linux uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ steps.tag-selector.outputs.tag }} + release_name: Release $${{ steps.tag-selector.outputs.tag }} draft: false prerelease: false - - name: Build - run: mvn package -DskipTests -s .github/workflows/settings.xml + - id: maven-build + name: Maven build + uses: ./.github/actions/release + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + build-macos: + needs: prepare-release + strategy: + fail-fast: false + matrix: + platform: + - name: macos_x86-64 + runs-on: macos-13 + - name: macos_arm64 + runs-on: macos-14 + java: [17] + runs-on: ${{ matrix.platform.runs-on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 - - name: Test - run: mvn -B jar:jar surefire:test + - name: Install required packages + run: | + brew install ninja + # Required for macos-13 + pip install setuptools + # Required for macos-14 + brew install python-setuptools - - name: Deploy - env: - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - run: mvn deploy -Prelease -DskipTests -s .github/workflows/settings.xml + - name: Select Xcode version + run: sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer + + - id: maven-build + name: Maven build + uses: ./.github/actions/release + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + maven-gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + maven-gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} From 4d2f06617fa62c3739552b9eee62d89f54914c03 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Thu, 2 Jan 2025 13:43:33 +0100 Subject: [PATCH 4/4] Fixed release workflow --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e83d0b4..04005cba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,8 +18,36 @@ env: jobs: prepare-release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: + - name: Disk cleanup + run: | + set -x + df -h + #sudo du -h -d1 /usr/local + #sudo du -h -d1 /usr/local/share + #sudo du -h -d1 /usr/local/lib + #sudo du -h -d1 /usr/share + # 4.6G + sudo rm -rf /usr/local/.ghcup + # 1.7G + sudo rm -rf /usr/share/swift + # 1.4G + sudo rm -rf /usr/share/dotnet + # 13G + sudo rm -rf /usr/local/lib/android + df -h + + - name: Install required packages + run: | + sudo apt-get update + sudo apt-get install -y pulseaudio libpulse-dev libasound2-dev libdbus-1-dev libudev-dev libv4l-dev libx11-dev binutils cmake git locales lsb-release ninja-build pkg-config python3 python3-setuptools rsync unzip wget xz-utils + # Required for testing + pulseaudio --start + #sudo apt-get install -y pipewire pipewire-pulse gstreamer1.0-pipewire libspa-0.2-bluetooth libspa-0.2-jack pipewire-audio-client-libraries + #systemctl --user daemon-reload + #systemctl --user --now enable pipewire{,-pulse}.{socket,service} + - name: Set up Java uses: actions/setup-java@v4 with: @@ -57,6 +85,17 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Get tag from current branch + id: tag-selector + shell: bash + run: | + git fetch -a + tag=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "tag=$tag" >> "$GITHUB_OUTPUT" + git checkout $tag - name: Set up Python 3.11 if: false @@ -163,7 +202,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.tag-selector.outputs.tag }} - release_name: Release $${{ steps.tag-selector.outputs.tag }} + release_name: Release ${{ steps.tag-selector.outputs.tag }} draft: false prerelease: false @@ -193,6 +232,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Get tag from current branch + id: tag-selector + run: | + git fetch -a + tag=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "tag=$tag" >> "$GITHUB_OUTPUT" + git checkout $tag - name: Install required packages run: |