Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and release using GitHub Actions #261

Merged
merged 5 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build and Release
on:
pull_request:
push:
env:
CMAKE_BUILD_TYPE: Release
jobs:
build:
name: Build
strategy:
matrix:
include:
- os: ubuntu-latest
build_command: |
mkdir build
cd build
cmake -DCPACK_GENERATOR=DEB ..
cmake --build .
cpack -C CPackConfig.cmake -V
ls -l
build_artifact: glslViewer-*-amd64.deb
- os: windows-latest
build_command: |
mkdir build
cd build
cmake -DCPACK_GENERATOR=ZIP -G "NMake Makefiles" ..
cmake --build .
cpack -C CPackConfig.cmake -V
dir
build_artifact: glslViewer-*-win64-AMD64.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
cmake xorg-dev libglu1-mesa-dev libavcodec-dev libavfilter-dev \
libavdevice-dev libavformat-dev libavutil-dev libswscale-dev \
libv4l-dev libjpeg-dev libpng-dev libtiff-dev

- name: Set up MSVC environment (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
$FfmpegUri = 'https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n4.4-latest-win64-lgpl-shared-4.4.zip'
$FfmpegZipPath = "$Env:GITHUB_WORKSPACE\ffmpeg.zip"
$ZlibUri = 'https://sourceforge.net/projects/gnuwin32/files/zlib/1.2.3/zlib-1.2.3-lib.zip/download'
$ZlibZipPath = "$Env:GITHUB_WORKSPACE\zlib.zip"

$FfmpegPath = "$Env:GITHUB_WORKSPACE\ffmpeg"

Start-BitsTransfer -Source "$FfmpegUri","$ZlibUri" -Destination "$FfmpegZipPath","$ZlibZipPath"

Expand-Archive -Path "$FfmpegZipPath" -DestinationPath "$FfmpegPath"
Move-Item -Path "$FfmpegPath\ffmpeg-*\*" -Destination "$FfmpegPath"

Expand-Archive -Path "$ZlibZipPath" -DestinationPath "$FfmpegPath"

echo "CMAKE_PREFIX_PATH=$FfmpegPath" >>$Env:GITHUB_ENV

- name: Build
run: ${{ matrix.build_command }}

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: glslViewer-${{ matrix.os }}-build
path: build/${{ matrix.build_artifact }}
retention-days: 7

release:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
name: Release
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2

- name: Create release
uses: softprops/action-gh-release@v1
with:
name: GlslViewer ${{ github.ref_name }}
files: |
glslViewer-ubuntu-latest-build/*
glslViewer-windows-latest-build/*
generate_release_notes: true
body: |
To use the Windows build, please download [FFmpeg 4.4][ffmpeg] and copy `bin\*.dll` alongside `glslViewer.exe`.

[ffmpeg]: https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n4.4-latest-win64-gpl-shared-4.4.zip
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ else()
Ws2_32.lib
Iphlpapi.lib
)


install(TARGETS glslViewer)

set(CPACK_GENERATOR "ZIP")

else()
target_link_libraries(glslViewer PRIVATE pthread dl lo_static)
install(TARGETS glslViewer DESTINATION bin)
Expand All @@ -152,6 +156,8 @@ else()
set(DEBSRC_BUILD_DEPENDS debhelper git cmake xorg-dev libgbm-dev libglu1-mesa-dev libavcodec-dev libavfilter-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev libv4l-dev libjpeg-dev libpng-dev libtiff-dev)
set(DEBSRC_PACKAGE_DEPENDS git cmake ffmpeg libavcodec-extra libavfilter-extra)

set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

set(CPACK_DEBIAN_PACKAGE_DEPENDS)
foreach(DEP ${DEBSRC_PACKAGE_DEPENDS})
set(CPACK_DEBIAN_PACKAGE_DEPEND "${CPACK_DEBIAN_PACKAGE_DEPENDS}, ${DEP}")
Expand Down Expand Up @@ -182,10 +188,10 @@ else()
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}-${DEB_ARCHITECTURE}")
endif()

include(CPack)

endif()

include(CPack)

endif()


Expand Down
2 changes: 1 addition & 1 deletion deps/ada