Skip to content

Commit

Permalink
Building using docker
Browse files Browse the repository at this point in the history
  • Loading branch information
doumdi committed Jan 8, 2024
1 parent e0413b3 commit 459f7bc
Showing 1 changed file with 36 additions and 64 deletions.
100 changes: 36 additions & 64 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ name: build_and_release

on:
workflow_dispatch:
branches: [main]
inputs:
fail_fast:
description: "Should stop the workflow as soon as one configuration fails"
required: false
type: boolean
default: true

jobs:
create-release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Generate Version Output
id: generate_version_output
run: echo "::set-output name=version::$(cat VERSION)"
Expand Down Expand Up @@ -51,41 +56,37 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
architecture: [amd64, arm64]
architecture: [arm64, amd64]
build-type: [Release, Debug]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:

- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 1024
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
root-reserve-mb: 30000
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'

- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/download-artifact@v4
with:
name: release_url

- name: Get Upload URL
id: get_release_info
run: |
echo "::set-output name=upload_url::$(cat release_url.txt)"
echo "upload_url=$(cat release_url.txt)" >> $GITHUB_OUTPUT
ls -l
cat release_url.txt
- name: Generate Version Output
id: generate_version_output
run: echo "::set-output name=version::$(cat VERSION)"
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
shell: bash

- name: Print Version Information
Expand All @@ -95,57 +96,28 @@ jobs:
- name: Generate Release File Name
id: generate_release_file_name
run: |
echo "::set-output name=release_file_name::webrtc-native-build-${{ matrix.os }}-\
echo "release_file_name=webrtc-native-build-${{ matrix.os }}-\
${{ matrix.architecture }}-\
${{ matrix.build-type }}-\
${{ steps.generate_version_output.outputs.version }}"
- name: Print Release File Name
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }}"
shell: bash

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake build-essential libssl-dev libboost-all-dev
sudo apt-get install libglib2.0-dev libgtk-3-dev libpulse-dev libasound2-dev
- name: Install cross compilation dependencies (default GCC)
run: |
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
if: matrix.architecture == 'arm64' && matrix.os != 'ubuntu-20.04'
${{ steps.generate_version_output.outputs.version }}" >> $GITHUB_OUTPUT
- name: Install cross compilation dependencies (GCC 10)
- name: Generate Branch Name
id: generate_branch_name
run: |
sudo apt-get install g++-10-aarch64-linux-gnu gcc-10-aarch64-linux-gnu
sudo apt-get install gcc-10-arm-linux-gnueabihf g++-10-arm-linux-gnueabihf
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-10 100
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-10 100
sudo update-alternatives --set aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-10
sudo update-alternatives --set aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-10
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-10 100
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-10 100
sudo update-alternatives --set arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-10
sudo update-alternatives --set arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-10
if: matrix.architecture == 'arm64' && matrix.os == 'ubuntu-20.04'
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Create build directory
working-directory: .
run: |
mkdir build
- name: Print Release File Name
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }} on branch ${{ steps.generate_branch_name.outputs.branch_name }}"
shell: bash

- name: Run CMake and build webrtc-native-build
working-directory: build
- name: Create and run Docker Image
working-directory: ./docker/${{ matrix.os }}
run: |
cmake ../ -DCMAKE_BUILD_TYPE=${{ matrix.build-type}} -DCMAKE_BUILD_ARCHITECTURE=${{ matrix.architecture }}
make -j2
make install
docker buildx build -t webrtc --build-arg BUILD_TYPE=${{ matrix.build-type }} --build-arg BUILD_ARCHITECTURE=${{ matrix.architecture }} --build-arg BUILD_BRANCH=${{ steps.generate_branch_name.outputs.branch_name }} .
docker run --rm --volume $PWD:/data webrtc tar cvzf /data/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz ./webrtc-native-build-${{ steps.generate_version_output.outputs.version }}
ls -l
- name: Create Archive
working-directory: dist/${{ matrix.build-type }}
run: |
tar cvzf ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz webrtc-native-build-${{ steps.generate_version_output.outputs.version }}
shell: bash

- name: Upload Release Asset
id: upload-release-asset
Expand All @@ -154,7 +126,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: dist/${{ matrix.build-type }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_path: /data/${{ matrix.build-type }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_name: ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_content_type: application/x-gzip

Expand All @@ -168,7 +140,7 @@ jobs:
build-type: [Release, Debug]

runs-on: ${{ matrix.os }}
steps:
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
Expand Down

0 comments on commit 459f7bc

Please sign in to comment.