Skip to content

Commit

Permalink
workflows extracted everything to env. variables
Browse files Browse the repository at this point in the history
For easier updates and to minimize replace points/locations.
  • Loading branch information
silverqx committed Jun 11, 2024
1 parent 411c134 commit 0ddc830
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 152 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/clang-cl-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
env:
TINY_QT_VERSION: 6.7.1
TINY_QT_SPEC: msvc2019_64
TINY_LLVM_VERSION: 18.1.7
# Initial build size 1.4G :/
TINY_CCACHE_MAX_SIZE: 2G
TINY_MYSQL_SERVICE: MySQL
TINY_POSTGRES_SERVICE: postgresql-x64-14

steps:
- uses: actions/checkout@v4
Expand All @@ -47,6 +52,8 @@ jobs:
$mysqlDataPath = Join-Path -Path $runnerWorkPath -ChildPath 'mysql/data'
"TinyMySQLDataPath=$mysqlDataPath" >> $env:GITHUB_ENV
"TinyParallel=$env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}

Expand Down Expand Up @@ -173,8 +180,8 @@ jobs:
- name: PostgreSQL service start
run: |
Set-Service -Name postgresql-x64-14 -StartupType Manual
Start-Service postgresql-x64-14
Set-Service -Name $env:TINY_POSTGRES_SERVICE -StartupType Manual
Start-Service $env:TINY_POSTGRES_SERVICE
- name: PostgreSQL change ${{ secrets.DB_PGSQL_ROOT_USERNAME }} password
run: >-
Expand Down Expand Up @@ -227,20 +234,18 @@ jobs:

- name: PostgreSQL service restart
run: |
Restart-Service postgresql-x64-14
Restart-Service $env:TINY_POSTGRES_SERVICE
- name: PostgreSQL service check status
run: |
$serviceName = 'postgresql-x64-14'
Write-Output '::group::Get-Service'
$pgsqlService = Get-Service $serviceName
$pgsqlService = Get-Service $env:TINY_POSTGRES_SERVICE
Write-Output $pgsqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$pgsqlService.status.ToString() -ceq 'Running' -or `
$(throw "$serviceName service is not running") > $null
$(throw "$env:TINY_POSTGRES_SERVICE service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::pg_isready'
Expand Down Expand Up @@ -395,8 +400,8 @@ jobs:
- name: MySQL service install/start
run: |
mysqld.exe --install MySQL
Start-Service MySQL
mysqld.exe --install $env:TINY_MYSQL_SERVICE
Start-Service $env:TINY_MYSQL_SERVICE
# Securing the root account even on localhost is for testing to make sure that everything
# works as expected
Expand Down Expand Up @@ -470,24 +475,22 @@ jobs:
"source $filepath" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD mysql
Restart-Service MySQL
Restart-Service $env:TINY_MYSQL_SERVICE
env:
extracted_folder: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.ExtractedFolder }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}

- name: MySQL service check status
run: |
$serviceName = 'MySQL'
Write-Output '::group::Get-Service'
$mysqlService = Get-Service $serviceName
$mysqlService = Get-Service $env:TINY_MYSQL_SERVICE
Write-Output $mysqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$mysqlService.status.ToString() -ceq 'Running' -or `
$(throw "$serviceName service is not running") > $null
$(throw "$env:TINY_MYSQL_SERVICE service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::Ping'
Expand Down Expand Up @@ -615,10 +618,10 @@ jobs:
C:/Program Files/LLVM
key: llvm-18.1.7

- name: Install LLVM and Clang 18.1.7
- name: Install LLVM and Clang ${{ env.TINY_LLVM_VERSION }}
uses: KyleMayes/install-llvm-action@v1
with:
version: 18.1.7
version: ${{ env.TINY_LLVM_VERSION }}
force-version: true
cached: ${{ steps.llvm-cache.outputs.cache-hit }}

Expand Down Expand Up @@ -650,8 +653,7 @@ jobs:

- name: Ccache prepare configuration 🥳
run: |
# Initial build size 1.4G :/
ccache.exe --set-config max_size=2G
ccache.exe --set-config max_size=$env:TINY_CCACHE_MAX_SIZE
ccache.exe --set-config sloppiness=pch_defines,time_macros
ccache.exe --set-config depend_mode=true
ccache.exe --set-config inode_cache=true
Expand Down Expand Up @@ -714,7 +716,7 @@ jobs:
- name: TinyORM cmake build ✨ (clang-cl-cmake-debug)
run: >-
cmake.exe --build ../TinyORM-builds-cmake/build-clang-cl-cmake-debug --target all
--parallel 2
--parallel $env:TinyParallel
- name: Ccache print statistics
run: |
Expand Down Expand Up @@ -749,10 +751,12 @@ jobs:
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTDATA_ENV: ${{ vars.TOM_TESTDATA_ENV }}

# $env:NUMBER_OF_PROCESSORS / 2 : rounds down
- name: TinyORM execute ctest 🔥
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug
run: |
ctest.exe --output-on-failure --parallel 4
run: >-
ctest.exe --output-on-failure
--parallel ([int] $env:TinyParallel + $env:NUMBER_OF_PROCESSORS / 2)
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
Expand Down
38 changes: 29 additions & 9 deletions .github/workflows/linux-qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ jobs:

runs-on: ubuntu-24.04

env:
# This number must also be changed in the matrix as env context can't be used in the matrix
TINY_LLVM_VERSION: 18
TINY_LLVM_APT_NAME: noble
# First value is a compressed data size
# gcc: ~ 115 * 3 + 100 ; clang: ~ 90 * 3 + 100
TINY_CCACHE_MAX_SIZE_GCC: 450M
TINY_CCACHE_MAX_SIZE_CLANG: 380M
# Clang and vcpkg use $(nproc --all) (max. available cores)
TINY_PARALLEL_GCC: 2

strategy:
matrix:
compiler:
Expand All @@ -41,6 +52,16 @@ jobs:
sqlitePath="$runnerWorkPath/SQLite/$DB_SQLITE_DATABASE"
echo "TinySQLitePath=$sqlitePath" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_GCC" \
|| ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_CLANG"
echo "TinyCcacheMaxSize=$ccacheMaxSize" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && parallel=$TINY_PARALLEL_GCC \
|| parallel=$(nproc --all)
echo "TinyParallel=$parallel" >> $GITHUB_ENV
echo "TinyParallelVcpkg=$(nproc --all)" >> $GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}

Expand Down Expand Up @@ -174,14 +195,15 @@ jobs:
sqlite3 --version
echo '::endgroup::'
- name: add-apt-repository Clang 18
- name: add-apt-repository Clang ${{ env.TINY_LLVM_VERSION }}
if: matrix.compiler.key == 'clang'
run: >-
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/llvm-18.asc > /dev/null
sudo tee /etc/apt/trusted.gpg.d/llvm-${{ env.TINY_LLVM_VERSION }}.asc > /dev/null
sudo add-apt-repository --yes
--sourceslist 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main'
--sourceslist 'deb http://apt.llvm.org/${{ env.TINY_LLVM_APT_NAME }}/
llvm-toolchain-${{ env.TINY_LLVM_APT_NAME }}-${{ env.TINY_LLVM_VERSION }} main'
- name: apt update
run: |
Expand Down Expand Up @@ -220,9 +242,7 @@ jobs:

- name: Ccache prepare configuration 🥳
run: |
# First value is a compressed data size
# gcc: ~ 115 * 3 + 100 ; clang: ~ 90 * 3 + 100
ccache --set-config max_size=${{ matrix.compiler.key == 'gcc' && '450M' || '380M' }}
ccache --set-config max_size="$TinyCcacheMaxSize"
ccache --set-config sloppiness=pch_defines,time_macros
ccache --show-config
Expand All @@ -240,7 +260,7 @@ jobs:
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV
echo 'VCPKG_MAX_CONCURRENCY=2' >> $GITHUB_ENV
echo "VCPKG_MAX_CONCURRENCY=$TinyParallelVcpkg" >> $GITHUB_ENV
- name: CMake print version
run: |
Expand Down Expand Up @@ -283,7 +303,7 @@ jobs:
- name: TinyORM cmake build ✨ (${{ matrix.compiler.name }}-cmake-debug)
run: >-
cmake --build ../TinyORM-builds-cmake/build-${{ matrix.compiler.name }}-cmake-debug
--target all --parallel 2
--target all --parallel $TinyParallel
- name: Ccache print statistics
run: |
Expand Down Expand Up @@ -316,7 +336,7 @@ jobs:
- name: TinyORM execute ctest 🔥
working-directory: ../TinyORM-builds-cmake/build-${{ matrix.compiler.name }}-cmake-debug
run: |
ctest --output-on-failure --parallel 4
ctest --output-on-failure --parallel $(($TinyParallel + $(nproc --all) / 2))
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
Expand Down
38 changes: 29 additions & 9 deletions .github/workflows/linux-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ jobs:

runs-on: ubuntu-24.04

env:
# This number must also be changed in the matrix as env context can't be used in the matrix
TINY_LLVM_VERSION: 18
TINY_LLVM_APT_NAME: noble
# First value is a compressed data size
# gcc: ~ 165 * 3 + 100 ; clang: ~ 100 * 3 + 100
TINY_CCACHE_MAX_SIZE_GCC: 600M
TINY_CCACHE_MAX_SIZE_CLANG: 400M
# Clang and vcpkg use $(nproc --all) (max. available cores)
TINY_PARALLEL_GCC: 2

strategy:
matrix:
compiler:
Expand All @@ -50,6 +61,16 @@ jobs:
sqlitePath="$runnerWorkPath/SQLite/$DB_SQLITE_DATABASE"
echo "TinySQLitePath=$sqlitePath" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_GCC" \
|| ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_CLANG"
echo "TinyCcacheMaxSize=$ccacheMaxSize" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && parallel=$TINY_PARALLEL_GCC \
|| parallel=$(nproc --all)
echo "TinyParallel=$parallel" >> $GITHUB_ENV
echo "TinyParallelVcpkg=$(nproc --all)" >> $GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}

Expand Down Expand Up @@ -534,14 +555,15 @@ jobs:
sqlite3 --version
echo '::endgroup::'
- name: add-apt-repository Clang 18
- name: add-apt-repository Clang ${{ env.TINY_LLVM_VERSION }}
if: matrix.compiler.key == 'clang'
run: >-
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/llvm-18.asc > /dev/null
sudo tee /etc/apt/trusted.gpg.d/llvm-${{ env.TINY_LLVM_VERSION }}.asc > /dev/null
sudo add-apt-repository --yes
--sourceslist 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main'
--sourceslist 'deb http://apt.llvm.org/${{ env.TINY_LLVM_APT_NAME }}/
llvm-toolchain-${{ env.TINY_LLVM_APT_NAME }}-${{ env.TINY_LLVM_VERSION }} main'
- name: apt update
run: |
Expand Down Expand Up @@ -580,9 +602,7 @@ jobs:

- name: Ccache prepare configuration 🥳
run: |
# First value is a compressed data size
# gcc: ~ 165 * 3 + 100 ; clang: ~ 100 * 3 + 100
ccache --set-config max_size=${{ matrix.compiler.key == 'gcc' && '600M' || '400M' }}
ccache --set-config max_size="$TinyCcacheMaxSize"
ccache --set-config sloppiness=pch_defines,time_macros
- name: Ccache print version and configuration
Expand All @@ -599,7 +619,7 @@ jobs:
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV
echo 'VCPKG_MAX_CONCURRENCY=2' >> $GITHUB_ENV
echo "VCPKG_MAX_CONCURRENCY=$TinyParallelVcpkg" >> $GITHUB_ENV
- name: CMake print version
run: |
Expand Down Expand Up @@ -642,7 +662,7 @@ jobs:
- name: TinyORM cmake build ✨ (${{ matrix.compiler.name }}-cmake-debug)
run: >-
cmake --build ../TinyORM-builds-cmake/build-${{ matrix.compiler.name }}-cmake-debug
--target all --parallel 2
--target all --parallel $TinyParallel
- name: Ccache print statistics
run: |
Expand Down Expand Up @@ -679,7 +699,7 @@ jobs:
- name: TinyORM execute ctest 🔥
working-directory: ../TinyORM-builds-cmake/build-${{ matrix.compiler.name }}-cmake-debug
run: |
ctest --output-on-failure --parallel 4
ctest --output-on-failure --parallel $(($TinyParallel + $(nproc --all) / 2))
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
Expand Down
Loading

0 comments on commit 0ddc830

Please sign in to comment.