Update GitHub checkout action to latest version
[openjpeg.git] / .github / workflows / build.yml
1 name: Build
2
3 on: [push, pull_request, workflow_dispatch]
4
5 jobs:
6   regular:
7     runs-on: ubuntu-latest
8     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
9     steps:
10       - name: Checkout
11         uses: actions/checkout@v4
12
13       - name: Install Requirements
14         run: |
15           sudo apt update
16           sudo apt install -y gcc g++ libtiff-dev libwebp-dev libzstd-dev
17
18       - name: Build and run tests
19         run: |
20             ./tools/travis-ci/install.sh
21             ./tools/travis-ci/run.sh
22         env:
23             OPJ_CI_ARCH: x86_64
24             OPJ_CI_BUILD_CONFIGURATION: Release
25             OPJ_CI_PERF_TESTS: 1
26             OPJ_CI_BUILD_FUZZERS: 1
27             OPJ_CI_INCLUDE_IF_DEPLOY: 1
28             OPJ_NONCOMMERCIAL: 1
29
30       - name: Release
31         uses: softprops/action-gh-release@v1
32         if: startsWith(github.ref, 'refs/tags/')
33         with:
34           files: build/openjpeg-*.tar.gz
35
36   asan:
37     runs-on: ubuntu-latest
38     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
39     steps:
40       - name: Checkout
41         uses: actions/checkout@v4
42
43       - name: Install Requirements
44         run: |
45           sudo apt update
46           sudo apt install -y gcc g++ python-is-python3
47
48       - name: Build and run tests
49         run: |
50             ./tools/travis-ci/install.sh
51             ./tools/travis-ci/run.sh
52         env:
53             OPJ_CI_ARCH: x86_64
54             OPJ_CI_BUILD_CONFIGURATION: Debug
55             OPJ_CI_ASAN: 1
56             OPJ_NONCOMMERCIAL: 1
57
58   clang_32bit:
59     runs-on: ubuntu-latest
60     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
61     steps:
62       - name: Checkout
63         uses: actions/checkout@v4
64
65       - name: Install Requirements
66         run: |
67           sudo apt update
68           sudo apt install -y clang gcc-multilib
69
70       - name: Build and run tests
71         run: |
72             ./tools/travis-ci/install.sh
73             ./tools/travis-ci/run.sh
74         env:
75             OPJ_CI_CC: clang
76             OPJ_CI_CXX: clang++
77             OPJ_CI_INSTRUCTION_SETS: "-mavx2"
78             OPJ_CI_BUILD_CONFIGURATION: Release
79             OPJ_CI_ARCH: i386
80             OPJ_NUM_THREADS: 2
81             OPJ_NONCOMMERCIAL: 1
82
83   mingw_64:
84     runs-on: ubuntu-latest
85     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
86     steps:
87       - name: Checkout
88         uses: actions/checkout@v4
89
90       - name: Install Requirements
91         run: |
92           sudo apt update
93           sudo apt install -y gcc-mingw-w64-base binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 gcc-mingw-w64 g++-mingw-w64-x86-64
94
95       - name: Build and run tests
96         run: |
97             ./tools/travis-ci/install.sh
98             ./tools/travis-ci/run.sh
99         env:
100             OPJ_CI_CC: x86_64-w64-mingw32-gcc
101             OPJ_CI_CXX: x86_64-w64-mingw32-g++
102             OPJ_CI_ARCH: x86_64
103             OPJ_CI_BUILD_CONFIGURATION: Release
104             OPJ_NONCOMMERCIAL: 1
105
106   macos:
107     runs-on: macos-latest
108     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
109     steps:
110       - name: Checkout
111         uses: actions/checkout@v4
112
113       - name: Build and run tests
114         run: |
115             ./tools/travis-ci/install.sh
116             ./tools/travis-ci/run.sh
117         env:
118             OPJ_CI_ARCH: x86_64
119             OPJ_CI_BUILD_CONFIGURATION: Release
120             OPJ_CI_INCLUDE_IF_DEPLOY: 1
121             #OPJ_NONCOMMERCIAL: 1
122
123       - name: Release
124         uses: softprops/action-gh-release@v1
125         if: startsWith(github.ref, 'refs/tags/')
126         with:
127           files: build/openjpeg-*.zip
128
129   windows_build:
130     runs-on: windows-2019
131     if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
132
133     strategy:
134       matrix:
135         include:
136           - VS_VER: 2019
137             OPJ_CI_ARCH: x64
138             OPJ_CI_INCLUDE_IF_DEPLOY: 1
139           - VS_VER: 2019
140             OPJ_CI_ARCH: x86
141             OPJ_CI_INCLUDE_IF_DEPLOY: 1
142           - VS_VER: 2019
143             OPJ_CI_ARCH: x64
144             # We do have specific failures noted in tools/travis-ci/knownfailures-windows-vs2015-x64-avx2-Release-3rdP.txt
145             # not sure why that happens
146             OPJ_CI_INSTRUCTION_SETS: "/arch:AVX2"
147
148     env:
149         VS_VER: ${{ matrix.VS_VER }}
150         OPJ_CI_ARCH: ${{ matrix.OPJ_CI_ARCH }}
151         OPJ_CI_INCLUDE_IF_DEPLOY: ${{ matrix.OPJ_CI_INCLUDE_IF_DEPLOY }}
152         OPJ_CI_INSTRUCTION_SETS: ${{ matrix.OPJ_CI_INSTRUCTION_SETS }}
153         #OPJ_NONCOMMERCIAL: 1
154
155     steps:
156
157       - name: Setup git
158         run: |
159           git config --global core.autocrlf false
160           git config --system core.longpaths true
161
162       - name: Checkout
163         uses: actions/checkout@v4
164
165       - name: Set compiler environment
166         shell: cmd
167         run: |
168             if "%VS_VER%" == "2019" CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=%OPJ_CI_ARCH%
169             echo PATH=%PATH%>> %GITHUB_ENV%
170             echo INCLUDE=%INCLUDE%>> %GITHUB_ENV%
171             echo LIB=%LIB%>> %GITHUB_ENV%
172             echo LIBPATH=%LIBPATH%>> %GITHUB_ENV%
173
174       - name: Install wget
175         shell: cmd
176         run: |
177             choco install wget --no-progress 
178
179       - name: Build and run tests
180         run: |
181             ./tools/travis-ci/install.sh
182             ./tools/travis-ci/run.sh
183         shell: bash
184
185       - name: Release
186         uses: softprops/action-gh-release@v1
187         if: ${{startsWith(github.ref, 'refs/tags/') && env.OPJ_CI_INCLUDE_IF_DEPLOY == 1}}
188         with:
189           files: build/openjpeg-*.zip