8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:03:04 +01:00

Refactor GitHub Actions using independent jobs instead of multiple conditional steps.

This commit is contained in:
Adriano dos Santos Fernandes 2022-08-07 21:14:53 -03:00
parent 780085554e
commit b14df5ce19

View File

@ -3,58 +3,20 @@ name: CI
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build:
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
strategy: build-linux-ubuntu-x64-clang:
fail-fast: false runs-on: ubuntu-20.04
matrix:
os:
- windows-2019
platform: [x64, x86]
include:
- os: ubuntu-18.04
platform: x64
container: alpine:3.14
- os: ubuntu-20.04
platform: x64
compiler: clang
- os: ubuntu-20.04
platform: x64
container: asfernandes/firebird-builder:x86_64-5
- os: ubuntu-20.04
platform: x86
# This build is failing at actions/upload-artifact when using the "container" way.
#container: asfernandes/firebird-builder:i586-5
docker: "docker"
- os: windows-2022
platform: x64
docker: "docker"
- os: windows-2022
platform: x86
docker: "docker"
- os: windows-2022
platform: x64
- os: windows-2022
platform: x86
- os: macOS-latest
platform: x64
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
with: with:
fetch-depth: 10 fetch-depth: 10
- name: Prepare (Ubuntu) - name: Prepare
if: startsWith(matrix.os, 'ubuntu-') && !matrix.container && !matrix.docker
run: | run: |
sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev
- name: Build (Ubuntu) - name: Build
if: startsWith(matrix.os, 'ubuntu-') && !matrix.container && !matrix.docker
run: | run: |
CC=clang CXX=clang++ ./autogen.sh --enable-binreloc --prefix=/opt/firebird CC=clang CXX=clang++ ./autogen.sh --enable-binreloc --prefix=/opt/firebird
make -j4 make -j4
@ -64,23 +26,62 @@ jobs:
tar xzvf gen/Firebird-[0-9]*.tar.gz tar xzvf gen/Firebird-[0-9]*.tar.gz
(cd Firebird-[0-9]*; sudo ./install.sh -silent) (cd Firebird-[0-9]*; sudo ./install.sh -silent)
- name: Build (Linux, Docker) - name: Upload
if: startsWith(matrix.container, 'asfernandes/firebird-builder') uses: actions/upload-artifact@main
with:
name: firebird-ubuntu-20.04-clang-x64
path: gen/Firebird-*.tar.gz
build-linux-docker-x64:
runs-on: ubuntu-20.04
container: asfernandes/firebird-builder:x86_64-5
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Build
run: /entry.sh run: /entry.sh
# asfernandes/firebird-builder:i586-5 - name: Upload
- name: Build (Linux, Docker) uses: actions/upload-artifact@main
if: startsWith(matrix.os, 'ubuntu-') && matrix.docker with:
name: firebird-linux-x64
path: gen/Firebird-*.tar.gz
build-linux-docker-x86:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Build
run: | run: |
cd builds/docker/linux/i586-x86_64 cd builds/docker/linux/i586-x86_64
./run-i586.sh ./run-i586.sh
- name: Prepare (Linux, Alpine) - name: Upload
if: startsWith(matrix.container, 'alpine') uses: actions/upload-artifact@main
with:
name: firebird-linux-x86
path: gen/Firebird-*.tar.gz
build-alpine-x64:
runs-on: ubuntu-20.04
container: alpine:3.14
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Prepare
run: apk update && apk --no-cache --update add build-base libtool git autoconf automake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar run: apk update && apk --no-cache --update add build-base libtool git autoconf automake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar
- name: Build (Linux, Alpine) - name: Build
if: startsWith(matrix.container, 'alpine')
run: | run: |
./autogen.sh --enable-binreloc-threads --with-builtin-tommath --with-builtin-tomcrypt --prefix=/opt/firebird ./autogen.sh --enable-binreloc-threads --with-builtin-tommath --with-builtin-tomcrypt --prefix=/opt/firebird
make -j4 make -j4
@ -89,22 +90,137 @@ jobs:
make dist make dist
tar xzvf gen/Firebird-[0-9]*.tar.gz tar xzvf gen/Firebird-[0-9]*.tar.gz
- name: Prepare - Install tools (MacOS) - name: Upload
if: matrix.os == 'macOS-latest' uses: actions/upload-artifact@main
with:
name: firebird-alpine-x64
path: gen/Firebird-*.tar.gz
build-windows:
runs-on: ${{ matrix.os }}
env:
VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- windows-2019
platform: [x64, x86]
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Prepare
shell: cmd
run: |
for /r %%i in (*.bat) do unix2dos "%%i"
choco uninstall --no-progress --yes innosetup
choco install --no-progress --yes innosetup --version=6.1.2
- name: Build
shell: cmd
env:
PLATFORM: ${{ matrix.platform }}
VS_SCRIPT: ${{ matrix.os == 'windows-2022' && 'C:\Program Files\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' || 'C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' }}
run: |
set SEVENZIP=C:\Program Files\7-Zip
set INNO6_SETUP_PATH=C:\Program Files (x86)\Inno Setup 6
if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64
if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64
if "%PLATFORM%" == "x64" set FB_OUTPUT_SUFFIX=x64
if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86
if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86
if "%PLATFORM%" == "x86" set FB_OUTPUT_SUFFIX=win32
call "%VS_SCRIPT%" -arch=%FB_VS_ARCH%
cd builds\win32
call run_all.bat
call run_tests.bat
- name: Extract zip
shell: cmd
run: |
7z x builds\install_images\*.zip -ooutput
- name: Upload zip
uses: actions/upload-artifact@main
with:
name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-zip
path: output
- name: Upload installer
uses: actions/upload-artifact@main
with:
name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-installer
path: builds/install_images/*.exe
build-windows-docker:
runs-on: windows-2022
env:
VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
strategy:
fail-fast: false
matrix:
platform: [x64, x86]
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Build
shell: cmd
env:
PLATFORM: ${{ matrix.platform }}
run: |
mkdir builds\install_images
cd builds\docker\windows
call build.bat
call run.bat C:\fbscripts\build-%PLATFORM%.bat
- name: Extract zip
shell: cmd
run: |
7z x builds\install_images\*.zip -ooutput
- name: Upload zip
uses: actions/upload-artifact@main
with:
name: firebird-windows-${{ matrix.platform }}-zip
path: output
- name: Upload installer
uses: actions/upload-artifact@main
with:
name: firebird-windows-${{ matrix.platform }}-installer
path: builds/install_images/*.exe
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Prepare - Install tools
run: | run: |
brew install automake libtool ninja brew install automake libtool ninja
- name: Cache - libc++ install (MacOS) - name: Cache - libc++ install
id: cache-libcxx-install-macos id: cache-libcxx-install-macos
if: matrix.os == 'macOS-latest'
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: ${{ runner.os }}-libcxx-install-13.0.1 key: ${{ runner.os }}-libcxx-install-13.0.1
path: | path: |
extern/libcxx-macos-install extern/libcxx-macos-install
- name: Download libc++ sources (MacOS) - name: Download libc++ sources
if: matrix.os == 'macOS-latest' && steps.cache-libcxx-install-macos.outputs.cache-hit != 'true' if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
run: | run: |
mkdir extern/libcxx-macos mkdir extern/libcxx-macos
pushd extern/libcxx-macos pushd extern/libcxx-macos
@ -112,8 +228,8 @@ jobs:
tar xJf llvm-project-13.0.1.src.tar.xz tar xJf llvm-project-13.0.1.src.tar.xz
popd popd
- name: Build libc++ (MacOS) - name: Build libc++
if: matrix.os == 'macOS-latest' && steps.cache-libcxx-install-macos.outputs.cache-hit != 'true' if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
run: | run: |
LIBCXX_BUILD_PATH=`pwd`/extern/libcxx-macos-build LIBCXX_BUILD_PATH=`pwd`/extern/libcxx-macos-build
LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install
@ -130,17 +246,16 @@ jobs:
ninja -C $LIBCXX_BUILD_PATH install-cxx install-cxxabi ninja -C $LIBCXX_BUILD_PATH install-cxx install-cxxabi
popd popd
- name: Cache - libicu install (MacOS) - name: Cache - libicu install
id: cache-libicu-install-macos id: cache-libicu-install-macos
if: matrix.os == 'macOS-latest'
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: ${{ runner.os }}-libicu-install-63.2 key: ${{ runner.os }}-libicu-install-63.2
path: | path: |
extern/libicu-macos-install extern/libicu-macos-install
- name: Download and patch libicu sources (MacOS) - name: Download and patch libicu sources
if: matrix.os == 'macOS-latest' && steps.cache-libicu-install-macos.outputs.cache-hit != 'true' if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
run: | run: |
mkdir extern/libicu-macos mkdir extern/libicu-macos
pushd extern/libicu-macos pushd extern/libicu-macos
@ -151,8 +266,8 @@ jobs:
patch -p3 < ../../24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch patch -p3 < ../../24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch
popd popd
- name: Build libicu (MacOS) - name: Build libicu
if: matrix.os == 'macOS-latest' && steps.cache-libicu-install-macos.outputs.cache-hit != 'true' if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
run: | run: |
export LIBTOOLIZE=glibtoolize export LIBTOOLIZE=glibtoolize
export LIBTOOL=glibtool export LIBTOOL=glibtool
@ -170,8 +285,7 @@ jobs:
install_name_tool -change libicuuc.63.dylib @loader_path/libicuuc.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib install_name_tool -change libicuuc.63.dylib @loader_path/libicuuc.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib
popd popd
- name: Build (MacOS) - name: Build
if: matrix.os == 'macOS-latest'
run: | run: |
export LIBTOOLIZE=glibtoolize export LIBTOOLIZE=glibtoolize
export LIBTOOL=glibtool export LIBTOOL=glibtool
@ -207,103 +321,8 @@ jobs:
mkdir gen/artifacts mkdir gen/artifacts
mv gen/Release/*.pkg gen/artifacts mv gen/Release/*.pkg gen/artifacts
- name: Prepare (Windows) - name: Upload
if: startsWith(matrix.os, 'windows-')
shell: cmd
run: |
for /r %%i in (*.bat) do unix2dos "%%i"
choco uninstall --no-progress --yes innosetup
choco install --no-progress --yes innosetup --version=6.1.2
- name: Build (Windows)
if: startsWith(matrix.os, 'windows-') && !matrix.docker
shell: cmd
env:
PLATFORM: ${{ matrix.platform }}
VS_SCRIPT: ${{ matrix.os == 'windows-2022' && 'C:\Program Files\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' || 'C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' }}
run: |
set SEVENZIP=C:\Program Files\7-Zip
set INNO6_SETUP_PATH=C:\Program Files (x86)\Inno Setup 6
if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64
if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64
if "%PLATFORM%" == "x64" set FB_OUTPUT_SUFFIX=x64
if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86
if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86
if "%PLATFORM%" == "x86" set FB_OUTPUT_SUFFIX=win32
call "%VS_SCRIPT%" -arch=%FB_VS_ARCH%
cd builds\win32
call run_all.bat
call run_tests.bat
- name: Build (Windows, Docker)
if: startsWith(matrix.os, 'windows-') && matrix.docker
shell: cmd
env:
PLATFORM: ${{ matrix.platform }}
run: |
mkdir builds\install_images
cd builds\docker\windows
call build.bat
call run.bat C:\fbscripts\build-%PLATFORM%.bat
- name: Upload (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-') && !matrix.container && !matrix.docker
uses: actions/upload-artifact@main
with:
name: firebird-ubuntu-20.04-clang-${{ matrix.platform }}
path: gen/Firebird-*.tar.gz
- name: Upload (Linux, Docker)
if: startsWith(matrix.container, 'asfernandes/firebird-builder') || (startsWith(matrix.os, 'ubuntu-') && matrix.docker)
uses: actions/upload-artifact@main
with:
name: firebird-linux-${{ matrix.platform }}
path: gen/Firebird-*.tar.gz
- name: Upload (Linux, Alpine)
if: startsWith(matrix.container, 'alpine')
uses: actions/upload-artifact@main
with:
name: firebird-alpine-x64
path: gen/Firebird-*.tar.gz
- name: Upload (MacOS)
if: matrix.os == 'macOS-latest'
uses: actions/upload-artifact@main uses: actions/upload-artifact@main
with: with:
name: firebird-macos name: firebird-macos
path: gen/artifacts path: gen/artifacts
- name: Extract zip (Windows)
if: startsWith(matrix.os, 'windows-')
shell: cmd
run: |
7z x builds\install_images\*.zip -ooutput
- name: Upload zip (Windows)
if: startsWith(matrix.os, 'windows-') && !matrix.docker
uses: actions/upload-artifact@main
with:
name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-zip
path: output
- name: Upload zip (Windows, Docker)
if: startsWith(matrix.os, 'windows-') && matrix.docker
uses: actions/upload-artifact@main
with:
name: firebird-windows-${{ matrix.platform }}-zip
path: output
- name: Upload installer (Windows)
if: startsWith(matrix.os, 'windows-') && !matrix.docker
uses: actions/upload-artifact@main
with:
name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-installer
path: builds/install_images/*.exe
- name: Upload installer (Windows, Docker)
if: startsWith(matrix.os, 'windows-') && matrix.docker
uses: actions/upload-artifact@main
with:
name: firebird-windows-${{ matrix.platform }}-installer
path: builds/install_images/*.exe