Skip to content

Commit

Permalink
ci: add a first build and release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrain34 committed Sep 27, 2024
1 parent 4b5c49d commit 234f8c0
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 0 deletions.
192 changes: 192 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: "vk_video_samples native build"
run-name: Native build by ${{ github.actor }}
on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- main
push:
branches:
- main
env:
REPO_NAME: vk_video_samples

jobs:
vk_video_decoder-linux:
strategy:
matrix:
platform: [linux-x86_64, linux-x86]
runs-on: ubuntu-22.04

env:
TERM: dumb

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set environment variables
run: |
echo "DESTDIR=$REPO_NAME-release" >> $GITHUB_ENV
- name: Set i386 environment variables
if: matrix.platform == 'linux-x86'
run: |
echo "CC=cc -m32" >> $GITHUB_ENV
echo "CXX=c++ -m32" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig/" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt update
sudo apt install --assume-yes --no-install-recommends valgrind python3-pip ninja-build
sudo apt install cmake
sudo apt install libx11-dev libwayland-dev
- name: Install i386 dependencies
if: matrix.platform == 'linux-x86'
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib libc6-dbg:i386
# hack to avoid that zlib x64 gets picked up
sudo apt remove --assume-yes zlib1g-dev
- name: Build
shell: bash
run: |
cd vk_video_decoder
bash ./update_external_sources.sh
mkdir BUILD
cd BUILD
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j
vk_video_encoder-linux:
strategy:
matrix:
platform: [linux-x86_64, linux-x86]
runs-on: ubuntu-22.04

env:
TERM: dumb

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set environment variables
run: |
echo "DESTDIR=$REPO_NAME-release" >> $GITHUB_ENV
- name: Set i386 environment variables
if: matrix.platform == 'linux-x86'
run: |
echo "CC=cc -m32" >> $GITHUB_ENV
echo "CXX=c++ -m32" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig/" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt update
sudo apt install --assume-yes --no-install-recommends valgrind python3-pip ninja-build
sudo apt install cmake
sudo apt install libx11-dev libwayland-dev
- name: Install i386 dependencies
if: matrix.platform == 'linux-x86'
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib libc6-dbg:i386
# hack to avoid that zlib x64 gets picked up
sudo apt remove --assume-yes zlib1g-dev
- name: Build
shell: bash
run: |
bash ./vk_video_decoder/update_external_sources.sh
cd vk_video_encoder
mkdir BUILD
cd BUILD
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j
vk_video_decoder-win:
strategy:
matrix:
platform: [windows-x64, windows-x86]
runs-on: windows-latest

steps:
- name: Set up X86 MSVC environment
if: matrix.platform == 'windows-x86'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: "x86"
- name: Checkout code
uses: actions/checkout@v3

- name: Set environment variables
run: echo "DESTDIR=$Env:REPO_NAME-release" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

- name: Install dependencies
run: |
choco install --yes zip
- name: Install python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install cmake
run: choco install cmake

- name: Build
run: |
./vk_video_decoder/update_external_sources.bat
cd vk_video_decoder
mkdir BUILD
cd BUILD
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j
vk_video_encoder-win:
strategy:
matrix:
platform: [windows-x64, windows-x86]
runs-on: windows-latest

steps:
- name: Set up X86 MSVC environment
if: matrix.platform == 'windows-x86'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: "x86"
- name: Checkout code
uses: actions/checkout@v3

- name: Set environment variables
run: echo "DESTDIR=$Env:REPO_NAME-release" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

- name: Install dependencies
run: |
choco install --yes zip
- name: Install python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install cmake
run: choco install cmake

- name: Build
run: |
./vk_video_decoder/update_external_sources.bat
cd vk_video_encoder
mkdir BUILD
cd BUILD
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
on:
workflow_dispatch:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release
env:
REPO_NAME: vk_video_samples
PRETTY_NAME: vk_video_samples
jobs:
build-release:
name: Build release
uses: ./.github/workflows/main.yml
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: build-release
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Archive Linux zip results
uses: actions/download-artifact@v3
env:
PLATFORM: linux-x86_64
with:
name: ${{ env.REPO_NAME }}-release-${{ env.PLATFORM }}
path: ./
- name: Create Linux release
env:
PLATFORM: linux-x86_64
shell: bash
run:
mv $REPO_NAME-release-$PLATFORM.zip $REPO_NAME-${{ github.ref_name }}-$PLATFORM.zip
- name: Upload linux release
env:
PLATFORM: linux-x86_64
uses: actions/upload-artifact@v3
with:
name: ${{ env.REPO_NAME }}-${{ env.ref_name }}-${{ github.PLATFORM }}
path: ${{ env.REPO_NAME }}-${{ env.ref_name }}-{{ github.PLATFORM }}.zip

- name: Archive Windows zip results
uses: actions/download-artifact@v3
env:
PLATFORM: windows-x64
with:
name: ${{ env.REPO_NAME }}-release-${{ env.PLATFORM }}
path: ./
- name: Create Windows release
env:
PLATFORM: windows-x64
shell: bash
run:
mv $REPO_NAME-release-$PLATFORM.zip $REPO_NAME-${{ github.ref_name }}-$PLATFORM.zip
- name: Upload Windows release
uses: actions/upload-artifact@v3
env:
PLATFORM: windows-x64
with:
name: ${{ env.REPO_NAME }}-${{ env.ref_name }}-${{ github.PLATFORM }}
path: ${{ env.REPO_NAME }}-${{ env.ref_name }}-{{ github.PLATFORM }}.zip

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: release-${{ github.ref_name }}
release_name: ${{ env.PRETTY_NAME }} ${{ github.ref_name }}
body: |
${{ env.PRETTY_NAME }}-${{ github.ref_name }} has been released. You can find details [here](https://github.com/dabrain34/${{ env.PRETTY_NAME }}/blob/main/Changelog.md)
draft: false
prerelease: false
- name: Upload Linux Release Asset
id: upload-linux-x86_64-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: linux-x86_64
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.REPO_NAME }}-${{ github.ref_name }}-${{ env.PLATFORM }}.zip
asset_name: ${{ env.REPO_NAME }}-${{ github.ref_name }}-${{ env.PLATFORM }}.zip
asset_content_type: application/zip
- name: Upload Windows Release Asset
id: upload-win64-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: windows-x64
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.REPO_NAME }}-${{ github.ref_name }}-${{ env.PLATFORM }}.zip
asset_name: ${{ env.REPO_NAME }}-${{ github.ref_name }}-${{ env.PLATFORM }}.zip
asset_content_type: application/zip

0 comments on commit 234f8c0

Please sign in to comment.