Refresh the build on Ubuntu 18.04, cancel in-progress builds. #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: zlib | |
on: [push, pull_request] | |
# Cancel in-progress builds on push to same branch / PR | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
ZLIB_VERSION: 1.2.13 | |
jobs: | |
windows: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Set up Visual Studio environment | |
uses: seanmiddleditch/gha-setup-vsdevenv@master | |
- name: Clone zlib | |
uses: actions/checkout@v3 | |
with: | |
repository: madler/zlib | |
ref: v${{ env.ZLIB_VERSION }} | |
path: zlib | |
- name: Build & install | |
shell: cmd | |
run: | | |
cmake ^ | |
-DCMAKE_C_COMPILER=cl.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DSKIP_INSTALL_FILES=ON ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/install ^ | |
-G Ninja -S zlib -B zlib-build | |
ninja -C zlib-build install | |
- name: Remove shared libraries | |
shell: cmd | |
run: | | |
del install\bin\zlib.dll | |
del install\lib\zlib.lib | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: zlib-${{ env.ZLIB_VERSION }}-${{ matrix.os }} | |
path: install | |
windows-mingw: | |
name: windows-mingw | |
runs-on: windows-2019 | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Set up MinGW environment | |
uses: msys2/setup-msys2@v2 | |
- name: Clone zlib | |
uses: actions/checkout@v3 | |
with: | |
repository: madler/zlib | |
ref: v${{ env.ZLIB_VERSION }} | |
path: zlib | |
- name: Build & install | |
shell: cmd | |
run: | | |
cmake ^ | |
-DCMAKE_C_COMPILER=gcc.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DSKIP_INSTALL_FILES=ON ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/install ^ | |
-G Ninja -S zlib -B zlib-build | |
ninja -C zlib-build install/strip | |
- name: Remove shared libraries | |
shell: cmd | |
run: | | |
del install\bin\libzlib.dll | |
del install\lib\libzlib.dll.a | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: zlib-${{ env.ZLIB_VERSION }}-windows-mingw | |
path: install | |
ubuntu: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-18.04 | |
runs-on: ubuntu-latest | |
container: ubuntu:bionic-20220427 | |
steps: | |
- name: Install base build tools | |
run: | | |
apt update | |
apt install -y ninja-build cmake g++ | |
mkdir -p deps | |
- name: Clone zlib | |
uses: actions/checkout@v3 | |
with: | |
repository: madler/zlib | |
ref: v${{ env.ZLIB_VERSION }} | |
path: zlib | |
- name: Build & install | |
run: | | |
mkdir build && cd build | |
cmake ../zlib \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DSKIP_INSTALL_FILES=ON \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \ | |
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | |
-G Ninja | |
ninja install/strip | |
- name: Remove shared libraries | |
run: | | |
rm -r install/lib/libz.so* | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: zlib-${{ env.ZLIB_VERSION }}-${{ matrix.os }} | |
path: install |