-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (130 loc) · 5.92 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build CI
on: [push, pull_request, workflow_dispatch]
env:
XPDF_VERSION: '4.02'
jobs:
build:
name: ${{ matrix.config.name }} Build
if: "! contains(github.event.head_commit.message, '[skip ci]')"
env:
BUILD_TYPE: Release
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { name: "Windows MSVC x86_64", os: windows-latest, cc: "cl", cxx: "cl", artifact: "vs2019.win64",cmake-configure-args: "-A x64"}
- { name: "Windows MSVC x86", os: windows-latest, cc: "cl", cxx: "cl", artifact: "vs2019.win32", cmake-configure-args: "-A Win32"}
- { name: "Ubuntu GCC x86_64", os: ubuntu-latest, cc: "gcc", cxx: "g++", artifact: "linux-gcc.x64", cmake-configure-args: "-G Ninja"}
- { name: "Ubuntu GCC x86", os: ubuntu-latest, cc: "gcc", cxx: "g++", artifact: "linux-gcc.x86", cmake-configure-args: "-G Ninja"}
- { name: "macOS Clang x86_64", os: macos-latest, cc: "clang", cxx: "clang++", artifact: "macos-clang.x64", cmake-configure-args: "-G Ninja"}
# - { name: "macOS Clang x86", os: macos-latest, cc: "gcc-9", cxx: "g++-9"}
steps:
- name: Checkout with Submodules
uses: actions/checkout@master
with:
submodules: true
- name: Setup CFLAGS && CXXFLAGS for x86 gcc & clang
run: |
echo "{CFLAGS}={-m32}" >> $GITHUB_ENV
echo "{CXXFLAGS}={-m32}" >> $GITHUB_ENV
shell: bash
if: (contains(matrix.config.name, '64') != true) && (contains(matrix.config.os, 'windows') != true)
- name: Install gcc-multilib & g++-multilib for x86 Ubuntu
run: sudo apt-get install gcc-multilib g++-multilib
shell: bash
if: (contains(matrix.config.name, '64') != true) && (contains(matrix.config.os, 'ubuntu') == true)
- name: Install MacOS Dependencies
shell: bash
run: brew install p7zip
if: contains(matrix.config.os, 'mac') == true
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@v1.1
with:
# ninja version to download. Default: 1.10.0
version: 1.10.0
- name: Build & Test
uses: ashutoshvarma/action-cmake-build@master
with:
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
configure-options: ${{ matrix.config.cmake-configure-args }}
ctest-options: -R xpdf
run-test: true
parallel: 14
build-dir: ${{ runner.workspace }}/build
build-type: ${{ env.BUILD_TYPE }}
install-build: true
install-options: "--prefix install_dir"
- name: Build Library Artifact
if: success()
shell: bash
run: |
pack_dir="../package_xpdf"
build_dir=$(echo "${{ runner.workspace }}/build" | sed -e 's/\\/\\\\/g')
mkdir -p "$pack_dir"/include && mkdir -p "$pack_dir"/lib
cp $build_dir/xpdf-4.02/*.h xpdf-4.02/*.h xpdf-4.02/*/*.h "$pack_dir"/include
if [ "${{ matrix.config.os }}" == "windows-latest" ]; then
lib_path="$build_dir/xpdf-4.02/xpdf/${{ env.BUILD_TYPE }}/xpdf.lib"
else
lib_path="$build_dir/xpdf-4.02/xpdf/libxpdf.a"
fi
cp $lib_path $pack_dir/lib
7z a libxpdf-${{ env.XPDF_VERSION }}.${{ matrix.config.artifact }}.zip $pack_dir/*
- name: Upload Artifact
uses: actions/upload-artifact@v1
if: success()
with:
name: libxpdf-${{ env.XPDF_VERSION }}.${{ matrix.config.artifact }}
path: libxpdf-${{ env.XPDF_VERSION }}.${{ matrix.config.artifact }}.zip
Release:
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
needs: [build]
name: Create Release with artifacts
if: success() && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Get Tag name
run: echo "::set-env name=TAG_NAME::${HEAD_REF#refs/tags/}"
env:
HEAD_REF: ${{ github.ref }}
- name: Create Archive Tarball
shell: bash
run: scripts/git-archive-all.sh --format tar.gz libxpdf-${{ env.XPDF_VERSION }}.tar.gz
- name: Download vs2019.win64 artifact
uses: actions/download-artifact@v1
with:
name: libxpdf-${{ env.XPDF_VERSION }}.vs2019.win64
- name: Download vs2019.win32 artifact
uses: actions/download-artifact@v1
with:
name: libxpdf-${{ env.XPDF_VERSION }}.vs2019.win32
- name: Download linux-gcc.x64 artifact
uses: actions/download-artifact@v1
with:
name: libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x64
- name: Download linux-gcc.x86 artifact
uses: actions/download-artifact@v1
with:
name: libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x86
- name: Download macos-clang.x64 artifact
uses: actions/download-artifact@v1
with:
name: libxpdf-${{ env.XPDF_VERSION }}.macos-clang.x64
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
name: libxpdf-${{ env.XPDF_VERSION }} - Release ${{ env.TAG_NAME }}
draft: false
prerelease: false
files: |
libxpdf-${{ env.XPDF_VERSION }}.vs2019.win64/libxpdf-${{ env.XPDF_VERSION }}.vs2019.win64.zip
libxpdf-${{ env.XPDF_VERSION }}.vs2019.win32/libxpdf-${{ env.XPDF_VERSION }}.vs2019.win32.zip
libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x64/libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x64.zip
libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x86/libxpdf-${{ env.XPDF_VERSION }}.linux-gcc.x86.zip
libxpdf-${{ env.XPDF_VERSION }}.macos-clang.x64/libxpdf-${{ env.XPDF_VERSION }}.macos-clang.x64.zip
libxpdf-${{ env.XPDF_VERSION }}.tar.gz