Skip to content

Linux + upstream zlib-ng #245

Linux + upstream zlib-ng

Linux + upstream zlib-ng #245

name: Linux + upstream zlib-ng
on:
workflow_dispatch:
push:
pull_request:
schedule:
- cron: '02 02 * * 6' # Run every Saturday
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
perl:
- latest
zlib-version:
- 'develop'
- '2.2.2'
- '2.2.1'
- '2.2.0'
- '2.1.8'
- '2.1.7'
- '2.1.6'
- '2.1.5'
- '2.1.4'
- '2.1.3'
- '2.1.2'
- '2.0.7'
- '2.0.6'
- '2.0.5'
- '2.0.4'
- '2.0.3'
- '2.0.2'
- '2.0.1'
- '2.0.0'
zlib-native:
- 1
- 0
env:
zlib-source: ${{ github.workspace }}/upstream-zlib-source
zlib-install: ${{ github.workspace }}/upstream-zlib-install
ZLIB_LIB: ${{ github.workspace }}/upstream-zlib-install/lib
ZLIB_INCLUDE: ${{ github.workspace }}/upstream-zlib-install/include
ZLIB_VERSION: ${{ matrix.zlib-version }}
BUILD_ZLIB: 0
ZLIB_NG_PRESENT: 1
USE_ZLIB_NG: ${{ matrix.zlib-native }}
NG_COMPAT_MODE: ${{ matrix.zlib-native == 1 && 'OFF' || 'ON' }}
# Run each step if
# 1. Not a scheduled job
# 2. Is sheduled AND zlib 'develop'
STEP_ENABLED: ${{ ( github.event_name != 'schedule' || ( github.event_name == 'schedule' && matrix.zlib-version == 'develop' ) ) && true || '' }}
defaults:
run:
working-directory: repo
name: Perl ${{ matrix.perl }} with zlib-ng ${{matrix.zlib-version}} USE_ZLIB_NG=${{ matrix.zlib-native }}
steps:
- uses: actions/checkout@v4
with:
path: repo
# - name: Cancel if Scheduled Job and not running the 'develop' branch
# if: github.event_name == 'schedule' && matrix.zlib-version != 'develop'
# run: |
# gh run cancel ${{ github.run_id }}
# gh run watch ${{ github.run_id }}
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make Paths
if: env.STEP_ENABLED
run: |
mkdir -p ${{ env.zlib-source }}
mkdir -p ${{ env.zlib-install }}
mkdir -p ${{ github.workspace }}/repo
- name: Cache zlib ${{matrix.zlib-version}} USE_ZLIB_NG=${{ matrix.zlib-native }}
id: cache-zlib
uses: actions/cache@v4
with:
# NOTE: path doesn't expand variables!
path: upstream-zlib-install
key: ${{ runner.os }}-${{ runner.arch }}-zlib-ng-${{ matrix.zlib-version }}-${{ matrix.zlib-native }}
- name: Wipe develop cached files, if found
if: env.STEP_ENABLED && matrix.zlib-version == 'develop' && steps.cache-zlib.outputs.cache-hit
run: |
rm -fr ${{ env.zlib-install }}
mkdir -p ${{ env.zlib-install }}
- name: Checkout upstream zlib-ng ${{matrix.zlib-version}} USE_ZLIB_NG=${{ matrix.zlib-native }}
if: env.STEP_ENABLED && ( matrix.zlib-version == 'develop' || ! steps.cache-zlib.outputs.cache-hit )
uses: actions/checkout@v4
with:
repository: zlib-ng/zlib-ng
ref: ${{ matrix.zlib-version }}
path: ${{ env.zlib-source }}
- name: Build zlib-ng ${{matrix.zlib-version}} USE_ZLIB_NG=${{ matrix.zlib-native }}
if: env.STEP_ENABLED && ( matrix.zlib-version == 'develop' || ! steps.cache-zlib.outputs.cache-hit )
run: |
mkdir build
cd build
cmake .. \
-DZLIB_COMPAT=${{ env.NG_COMPAT_MODE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.zlib-install }} \
-DZLIBNG_ENABLE_TESTS=OFF \
-DWITH_GZFILEOP=OFF \
-DZLIB_ENABLE_TESTS=OFF \
-DZLIBNG_ENABLE_TESTS=OFF \
-DWITH_OPTIM=OFF
make install
working-directory: ${{ env.zlib-source }}
# - name: Build zlib-ng ${{matrix.zlib-version}} zlib-compat mode ${{ matrix.zlib-native }}
# # if: ( matrix.zlib-version == 'develop' || steps.cache-zlib.outputs.cache-hit == 'false' ) && ! matrix.zlib-native
# if: env.STEP_ENABLED && ( matrix.zlib-version == 'develop' || ! steps.cache-zlib.outputs.cache-hit ) && ! matrix.zlib-native
# run: |
# ./configure --prefix ${{ env.zlib-install }} --zlib-compat
# make
# make test
# make install
# rm -fr ${{ env.zlib-install }}/share
# working-directory: ${{ env.zlib-source }}
# - name: Build zlib-ng ${{matrix.zlib-version}} zlib native mode
# # if: ( matrix.zlib-version == 'develop' || steps.cache-zlib.outputs.cache-hit == 'false' ) && matrix.zlib-native
# if: env.STEP_ENABLED && ( matrix.zlib-version == 'develop' || ! steps.cache-zlib.outputs.cache-hit ) && matrix.zlib-native
# run: |
# ./configure --prefix ${{ env.zlib-install }}
# make
# make test
# make install
# rm -fr ${{ env.zlib-install }}/share
# working-directory: ${{ env.zlib-source }}
- name: Show installed zlib files
if: env.STEP_ENABLED
run: |
find .
shell: bash
working-directory: ${{ env.zlib-install }}
- name: Setup perl
if: env.STEP_ENABLED
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- name: Perl version
if: env.STEP_ENABLED
run: perl -V
#- name: Install dependencies
# if: env.STEP_ENABLED
# run: |
# cpanm --verbose --installdeps --notest .
- name: Build
if: env.STEP_ENABLED
run: |
perl Makefile.PL && make
- name: Test
if: env.STEP_ENABLED
run: make test