Skip to content

Commit

Permalink
Workflow optimization (Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx authored and ronaldtse committed Apr 10, 2022
1 parent 4c37deb commit e374e8f
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 43 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/alpine-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/windows-x86_64.yml'
- '.github/workflows/msys-x86_64.yml'
pull_request:
workflow_dispatch:

Expand All @@ -33,8 +34,8 @@ jobs:
# vcpkg prerequisites (and VCPKG_FORCE_SYSTEM_BINARIES: 1)
# gcompat gperf flex bison gettext-dev python3 ninja zip unzip curl pkg-config
# testing prerequisites
# libxml2-utils
# [ tests/resources/emf/test-183.emf ] -- font-noto-hebrew font-noto-arabic
# libxml2-utils
# [ tests/resources/emf/test-183.emf ] -- font-noto-hebrew font-noto-arabic

- name: Checkout
uses: actions/checkout@v3
Expand All @@ -56,7 +57,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}-2
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure CMake
run: |
Expand All @@ -82,8 +83,8 @@ jobs:
steps:
- name: Install packages
run: |
apk --no-cache --upgrade add build-base cmake git valgrind tar bash \
gcompat gperf flex bison gettext-dev python3 ninja zip unzip curl pkgconfig
apk --no-cache --upgrade add build-base cmake git tar bash \
gcompat gperf flex bison gettext-dev python3 ninja zip unzip curl pkgconfig
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -105,7 +106,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}-2
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure CMake
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- '.github/workflows/alpine-x86_64.yml'
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/msys-x86_64.yml'
- '.github/workflows/windows-x86_64.yml'
- '.github/workflows/macos-x86_64.yml'
pull_request:
workflow_dispatch:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- '.github/workflows/alpine-x86_64.yml'
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/msys-x86_64.yml'
- '.github/workflows/windows-x86_64.yml'
- '.github/workflows/macos-arm64.yml'
pull_request:
workflow_dispatch:
Expand All @@ -16,7 +17,7 @@ env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/cache

jobs:
build:
build-and-test:
runs-on: macos-latest

steps:
Expand Down Expand Up @@ -74,7 +75,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}-2
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure CMake
run: |
Expand Down
138 changes: 138 additions & 0 deletions .github/workflows/msys-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: MSys-x86_64

on:
push:
paths-ignore:
- '.github/workflows/alpine-x86_64.yml'
- '.github/workflows/macos-x86_64.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/windows-x86_64.yml'
pull_request:
workflow_dispatch:

env:
BUILD_TYPE: Release
MAKEFLAGS: -j4

jobs:
build-and-smoke-test:
runs-on: windows-latest

defaults:
run:
shell: msys2 {0}
steps:
- name: Setup msys
uses: msys2/setup-msys2@v2
with:
path-type: minimal
msystem: mingw64
install: git flex bison gettext-devel
pacboy: gperf:p cmake:p python3:p ninja:p curl:p pkgconf:p gcc:p

- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure cache
run: |
echo 'VCPKG_DEFAULT_BINARY_CACHE<<EOF' >> $GITHUB_ENV
echo "$(pwd)/cache" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'CI_CACHE<<EOF' >> $GITHUB_ENV
echo "$(pwd -W)/cache" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create cache storage and cache key
run: |
mkdir ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
git submodule status > sm.txt
- name: Process cache
uses: actions/cache@v2
with:
path: ${{ env.CI_CACHE }}
key: ${{ github.workflow }}-mingw64-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}

- name: Smoke test
run: |
./emf2svg-conv.exe --version
./emf2svg-conv.exe -i tests/resources/emf/test-000.emf -o test-000.svg
ls | grep test-000.svg
build-for-ruby:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys:
- mingw64
- ucrt64
defaults:
run:
shell: msys2 {0}
steps:
- name: Setup msys
uses: msys2/setup-msys2@v2
with:
path-type: minimal
msystem: ${{ matrix.sys }}
install: git flex bison gettext-devel
pacboy: gperf:p cmake:p python3:p ninja:p curl:p pkgconf:p gcc:p

- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure cache
run: |
echo 'VCPKG_DEFAULT_BINARY_CACHE<<EOF' >> $GITHUB_ENV
echo "$(pwd)/cache" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'CI_CACHE<<EOF' >> $GITHUB_ENV
echo "$(pwd -W)/cache" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create cache storage and cache key
run: |
mkdir ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
git submodule status > sm.txt
- name: Process cache
uses: actions/cache@v2
with:
path: ${{ env.CI_CACHE }}
key: ${{ github.workflow }}-${{ matrix.sys }}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}

- name: Checkout shell test framework
uses: actions/checkout@v3
with:
repository: kward/shunit2
path: tests/shunit2
fetch-depth: 1

- name: Run additional tests
run: tests/resources/lcheck.sh
5 changes: 3 additions & 2 deletions .github/workflows/ubuntu-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/macos-x86_64.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/msys-x86_64.yml'
- '.github/workflows/windows-x86_64.yml'
pull_request:
workflow_dispatch:

Expand All @@ -16,7 +17,7 @@ env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/cache

jobs:
build:
build-and-smoke-test:
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- '.github/workflows/macos-x86_64.yml'
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/windows-build.yml'
- '.github/workflows/msys-x86_64.yml'
- '.github/workflows/windows-x86_64.yml'
pull_request:
workflow_dispatch:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows-build
name: Windows-x86_64

on:
push:
Expand All @@ -8,6 +8,7 @@ on:
- '.github/workflows/macos-arm64.yml'
- '.github/workflows/ubuntu-aarch64.yml'
- '.github/workflows/ubuntu-x86_64.yml'
- '.github/workflows/msys-x86_64.yml'
pull_request:
workflow_dispatch:

Expand All @@ -16,7 +17,7 @@ env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/cache

jobs:
build:
build-and-smoke-test:
runs-on: windows-latest

steps:
Expand Down Expand Up @@ -45,3 +46,9 @@ jobs:
- name: Build
run: cmake --build ${{ github.workspace }} --config ${{env.BUILD_TYPE}}

- name: Smoke test
run: |
Release/emf2svg-conv.exe --version
Release/emf2svg-conv.exe -i tests/resources/emf/test-000.emf -o test-000.svg
dir . | findstr test-000.svg
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ ExternalProject_Add(${FMEM_NAME}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/tamatebako/fmem.git
GIT_TAG bdce2760f0190253600f11984220fc0a007742c8
CMAKE_ARGS -DBUILD_TESTING=FALSE
-DCMAKE_INSTALL_PREFIX=${DEPS}
CMAKE_ARGS -DBUILD_TESTING=FALSE
-DCMAKE_INSTALL_PREFIX=${DEPS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${PLATFORM_TOOLCHAIN_OPTION}
${CMAKE_OSX_ARCHITECTURES_OPTION}
Expand Down Expand Up @@ -172,7 +172,7 @@ if(NOT LONLY)
else()
message(STATUS "Building argp")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# https://www.gnu.org/software/gnulib/manual/html_node/argp_005fprogram_005fversion_005fhook.html
# https://www.gnu.org/software/gnulib/manual/html_node/argp_005fprogram_005fversion_005fhook.html
set(EXTERNAL_ARGP "-Wl,-force_load,${DEPS}/lib/libargp-standalone.a")
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXTERNAL_ARGP "argp-standalone")
Expand Down
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
libemf2svg
==========
[![Ubuntu-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml) [![Ubuntu-aarch64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml) [![Alpine-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml)

![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-build.yml/badge.svg)
![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/macos-build.yml/badge.svg)
![Build status](https://github.com/metanorma/libemf2svg/actions/workflows/windows-build.yml/badge.svg)
[![Alpine build](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-build.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-build.yml)

[![Ubuntu-arm64 build](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-arm64.yml)
[![MacOS-arm64 build](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml)
[![MacOS-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml) [![MacOS-arm64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml) [![Windows-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml) [![MSys-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml)

[![Coverage Status](https://coveralls.io/repos/github/metanorma/libemf2svg/badge.svg?branch=master)](https://coveralls.io/github/metanorma/libemf2svg?branch=master)

Expand Down Expand Up @@ -65,12 +60,6 @@ Installing the dependencies on RHEL/CentOS/Fedora:
yum install cmake libpng-devel freetype-devel fontconfig-devel gcc-c++ gcc
```

Installing the dependencies on Alpine Linux:
```bash
apk --no-cache --upgrade add build-base clang cmake libxml2-dev \
libxml2-utils libpng-dev freetype-dev fontconfig-dev git argp-standalone
```

Installing the dependencies on Windows for MSVC native builds
Dependencies are installed by vcpkg package manager. Installation is implemented as a step of CMake configuration procedure.

Expand All @@ -97,9 +86,15 @@ $ cmake . -DCMAKE_INSTALL_PREFIX=/usr/
# Windows native (MSVC) build
$ cmake . -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake

# Linux cross-compilation
# (the only option tested is arm64 build on ubuntu x64)
$ cmake . -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-linux
# Cross-compilation
# This project employs vcpkg (https://github.com/microsoft/vcpkg) to setup cross-compilation environment
$ cmake . -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=<triplet>
# The following triplets are tested in CI:
# * x64-linux (both for Ubuntu and ALpine Linux)
# * arm64-linux (Ubuntu)
# * x64-osx
# * arm64-osx
# * x64-mingw-static

# compilation
$ make
Expand Down Expand Up @@ -236,6 +231,10 @@ EMF+ RECORDS:
ChangeLogs
----------

1.7.0:

* refactor build scripts to facilitate better portability and ruby integration

1.6.0:

* add arm64 MacOS support (cross-compilation only, no tests)
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/check_correctness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ STOPONERROR="no"

help(){
cat <<EOF
usage: `basename $0` [-h] [-v] [-e <emf dir>] [-s] [-n]
usage: `basename $0` [-h] [-v] [-e <emf dir>] [-s] [-n]
Script checking memleaks, segfault and svg correctness of emf2svg-conv
Expand All @@ -39,7 +39,7 @@ EOF
while getopts ":hnNxrvse:" opt; do
case $opt in

h)
h)
help
;;
n)
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/check_truncate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ burn_in_hell(){
while [ $counter1 -lt $MAX ]
do
tmp_emf=`mktemp -p ../out/`
cp emf/`ls emf |shuf -n 1` ${tmp_emf}
cp emf/`ls emf |shuf -n 1` ${tmp_emf}
counter2=0
while [ $counter2 -lt $MAX ]
do
Expand Down
Loading

0 comments on commit e374e8f

Please sign in to comment.