Skip to content

Commit

Permalink
workflows used $env:xyz inside steps
Browse files Browse the repository at this point in the history
Instead of the ${{ env/runner.xyz }} and similar for both Linux and
Windows.
  • Loading branch information
silverqx committed Jun 11, 2024
1 parent f9f211a commit 44b2f28
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 229 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/analyzers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:

- name: TinyORM prepare environment
run: |
runnerWorkPath=$(realpath '${{ runner.workspace }}/..')
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
# Starts with the merydeye-
[[ "${{ runner.name }}" == 'merydeye-'* ]] && isSelfHostedRunner='true' || isSelfHostedRunner='false'
[[ "$RUNNER_NAME" == 'merydeye-'* ]] && isSelfHostedRunner='true' || isSelfHostedRunner='false'
echo "TinyIsSelfHostedRunner=$isSelfHostedRunner" >> $GITHUB_ENV
# Parallel 4 ISN't maximum but because this workflow runs hours I will use parallel 4 to be
Expand All @@ -68,7 +68,7 @@ jobs:
tinyormBuildFolder="build-$tinyormBuildName"
echo "TinyORMBuildFolder=$tinyormBuildFolder" >> $GITHUB_ENV
tinyormBuildTree="${{ runner.workspace }}/TinyORM-builds-cmake/$tinyormBuildFolder"
tinyormBuildTree="$RUNNER_WORKSPACE/TinyORM-builds-cmake/$tinyormBuildFolder"
echo "TinyORMBuildTree=$tinyormBuildTree" >> $GITHUB_ENV
- name: Test self-hosted runner
Expand All @@ -86,7 +86,7 @@ jobs:
# Don't use the default CCACHE_DIR path on self-hosted runners
- name: Ccache prepare environment
run: |
ccacheDirPath=$(realpath '${{ runner.workspace }}/ccache')
ccacheDirPath=$(realpath "$RUNNER_WORKSPACE/ccache")
echo "CCACHE_DIR=$ccacheDirPath" >> $GITHUB_ENV
- name: Ccache prepare configuration 🥳
Expand All @@ -111,11 +111,11 @@ jobs:
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV
echo 'VCPKG_MAX_CONCURRENCY=${{ env.TinyParallel }}' >> $GITHUB_ENV
echo "VCPKG_MAX_CONCURRENCY=$TinyParallel" >> $GITHUB_ENV
- name: vcpkg needs upgrade? (once per day)
run: |
vcpkgUpgradedAtFilepath='${{ runner.workspace }}/.vcpkg_upgraded_at'
vcpkgUpgradedAtFilepath="$RUNNER_WORKSPACE/.vcpkg_upgraded_at"
if [ ! -f "$vcpkgUpgradedAtFilepath" ] || [ ! -r "$vcpkgUpgradedAtFilepath" ] || \
! read datePreviousUpgradeRaw < "$vcpkgUpgradedAtFilepath"
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
./bootstrap-vcpkg.sh
date +%Y-%m-%d > '${{ runner.workspace }}/.vcpkg_upgraded_at'
date +%Y-%m-%d > "$RUNNER_WORKSPACE/.vcpkg_upgraded_at"
- name: ${{ matrix.qt.name }} prepare environment
run: |
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
cmake
--log-level=DEBUG --log-context
-S .
-B '${{ env.TinyORMBuildTree }}'
-B "$TinyORMBuildTree"
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache
-D CMAKE_CXX_COMPILER:FILEPATH=clang++-18
Expand All @@ -219,7 +219,7 @@ jobs:
- name: TinyORM cmake build ✨ (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMBuildTree }}
run: >-
cmake --build . --target all --parallel ${{ env.TinyParallel }}
cmake --build . --target all --parallel $TinyParallel
- name: Ccache print statistics
run: |
Expand All @@ -232,8 +232,8 @@ jobs:
run-clang-tidy
-extra-arg-before='-Qunused-arguments'
-p='${{ env.TinyORMBuildTree }}'
-j ${{ env.TinyParallel }}
-p="$TinyORMBuildTree"
-j $TinyParallel
'[\\\/]+(?:drivers|examples|orm|src|tests|tom)[\\\/]+.+?[\\\/]+(?!mocs_)[\w\d_\-\+]+\.cpp$'
# Disabled checks
Expand Down Expand Up @@ -265,6 +265,6 @@ jobs:
-checks="$checks" \
-extra-arg-before='-Qunused-arguments' \
-header-filter='[\\\/]+(drivers|examples|orm|tests|tom)[\\\/]+.+\.(h|hpp)$' \
-j ${{ env.TinyParallel }} \
-p='${{ env.TinyORMBuildTree }}' \
-j $TinyParallel \
-p="$TinyORMBuildTree" \
'[\\\/]+(?:drivers|examples|orm|src|tests|tom)[\\\/]+.+?[\\\/]+(?!mocs_)[\w\d_\-\+]+\.cpp$'
46 changes: 22 additions & 24 deletions .github/workflows/clang-cl-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: TinyORM prepare environment
run: |
$runnerWorkPath = Resolve-Path -Path '${{ runner.workspace }}/..'
$runnerWorkPath = Resolve-Path -Path "$env:RUNNER_WORKSPACE/.."
"TinyRunnerWorkPath=$runnerWorkPath" >> $env:GITHUB_ENV
$sqlitePath = Join-Path -Path $runnerWorkPath -ChildPath "SQLite/$env:DB_SQLITE_DATABASE"
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: PostgreSQL SSL certificates initialize
id: openssl-initialize-postgresql-certificates
run: |
$folderPath = Join-Path -Path '${{ env.TinyRunnerWorkPath }}' `
$folderPath = Join-Path -Path $env:TinyRunnerWorkPath `
-ChildPath 'tiny-postgresql-certificates'
# Create an empty folder for generating certificates
Expand Down Expand Up @@ -261,15 +261,15 @@ jobs:

- name: MySQL create data folder
run: |
New-Item -Type Directory '${{ env.TinyMySQLDataPath }}'
New-Item -Type Directory $env:TinyMySQLDataPath
- name: MySQL initialize my.ini configuration
working-directory: .github/resources/windows
run: >-
(Get-Content -Path ./my_8_ssl.template.ini) -creplace
'\{MYSQL_DATADIR\}', '${{ env.TinyMySQLDataPath }}' -creplace
'\{MYSQL_DATADIR\}', $env:TinyMySQLDataPath -creplace
'\{MYSQL_HOST\}', $env:DB_MYSQL_HOST |
Set-Content -Path '${{ env.TinyMySQLInstallationPath }}/my.ini'
Set-Content -Path "$env:TinyMySQLInstallationPath/my.ini"
env:
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}

Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
- name: MySQL SSL certificates initialize
id: openssl-initialize-mysql-certificates
run: |
$folderPath = Join-Path -Path '${{ env.TinyRunnerWorkPath }}' `
$folderPath = Join-Path -Path $env:TinyRunnerWorkPath `
-ChildPath 'tiny-mysql-certificates'
# Create an empty folder for generating certificates
Expand Down Expand Up @@ -385,17 +385,15 @@ jobs:
working-directory: ${{ steps.openssl-initialize-mysql-certificates.outputs.FolderPath }}
run: |
Write-Output '::group::Install CA certificate'
Move-Item -Path ./ca.pem -Destination '${{ env.TinyMySQLDataPath }}'
Move-Item -Path ./ca.pem -Destination $env:TinyMySQLDataPath
Write-Output '::endgroup::'
Write-Output '::group::Install server certificates'
Move-Item -Path ./server-cert.pem, ./server-key.pem `
-Destination '${{ env.TinyMySQLDataPath }}'
Move-Item -Path ./server-cert.pem, ./server-key.pem -Destination $env:TinyMySQLDataPath
Write-Output '::endgroup::'
Write-Output '::group::Install client certificates'
Move-Item -Path ./client-cert.pem, ./client-key.pem `
-Destination '${{ env.TinyMySQLDataPath }}'
Move-Item -Path ./client-cert.pem, ./client-key.pem -Destination $env:TinyMySQLDataPath
Write-Output '::endgroup::'
- name: MySQL service install/start
Expand All @@ -411,8 +409,8 @@ jobs:
run: >-
"alter user '$env:DB_MYSQL_ROOT_USERNAME'@'localhost'
identified with caching_sha2_password by '$env:DB_MYSQL_ROOT_PASSWORD'
require issuer '${{ env.DB_MYSQL_SSL_SUBJECT_CA }}' and
subject '${{ env.DB_MYSQL_SSL_SUBJECT_CLIENT }}';" |
require issuer '$env:DB_MYSQL_SSL_SUBJECT_CA' and
subject '$env:DB_MYSQL_SSL_SUBJECT_CLIENT';" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME
--password=$($env:secured_password | ConvertTo-SecureString |
ConvertFrom-SecureString -AsPlainText)
Expand All @@ -430,12 +428,12 @@ jobs:
$filename = (Split-Path -Path $env:URL_MYSQL_TIMEZONE_TABLES -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path ${{ runner.temp }} -ChildPath $filename
$filepath = Join-Path -Path $env:RUNNER_TEMP -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$basename = Split-Path -Path $filename -LeafBase
$extractedFolder = Join-Path -Path ${{ runner.temp }} -ChildPath $basename
$extractedFolder = Join-Path -Path $env:RUNNER_TEMP -ChildPath $basename
"ExtractedFolder=$extractedFolder" >> $env:GITHUB_OUTPUT
"Hash=$basename" >> $env:GITHUB_OUTPUT
Expand All @@ -461,7 +459,7 @@ jobs:
Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
7z.exe x -y -o'${{ runner.temp }}' "$env:archive_filepath"
7z.exe x -y -o"$env:RUNNER_TEMP" $env:archive_filepath
env:
archive_filepath: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.Filepath }}
URL_MYSQL_TIMEZONE_TABLES: ${{ secrets.URL_MYSQL_TIMEZONE_TABLES }}
Expand Down Expand Up @@ -520,8 +518,8 @@ jobs:
run: >-
"create user '$env:DB_MYSQL_USERNAME'@'%'
identified with caching_sha2_password by '$env:DB_MYSQL_PASSWORD'
require issuer '${{ env.DB_MYSQL_SSL_SUBJECT_CA }}' and
subject '${{ env.DB_MYSQL_SSL_SUBJECT_CLIENT }}';
require issuer '$env:DB_MYSQL_SSL_SUBJECT_CA' and
subject '$env:DB_MYSQL_SSL_SUBJECT_CLIENT';
grant all privileges on ``tinyorm\_%``.* to '$env:DB_MYSQL_USERNAME'@'%';
grant select on ``mysql``.``time_zone_name`` to '$env:DB_MYSQL_USERNAME'@'%';
flush privileges;" |
Expand All @@ -536,16 +534,16 @@ jobs:

- name: MySQL add libmysql.dll on the $env:Path, INCLUDE, and LIB
run: |
'${{ env.TinyMySQLInstallationPath }}\lib' >> $env:GITHUB_PATH
"$env:TinyMySQLInstallationPath\lib" >> $env:GITHUB_PATH
# Needed by the lastest FindMySQL.cmake module, it stopped working without this
'INCLUDE=${{ env.TinyMySQLInstallationPath }}\include' >> $env:GITHUB_ENV
'LIB=${{ env.TinyMySQLInstallationPath }}\lib' >> $env:GITHUB_ENV
"INCLUDE=$env:TinyMySQLInstallationPath\include" >> $env:GITHUB_ENV
"LIB=$env:TinyMySQLInstallationPath\lib" >> $env:GITHUB_ENV
- name: SQLite create TinyORM database
run: |
New-Item -Type Directory (Split-Path -Parent -Path '${{ env.TinySQLitePath }}')
New-Item -Type Directory (Split-Path -Parent -Path $env:TinySQLitePath)
New-Item -Type File -Path '${{ env.TinySQLitePath }}'
New-Item -Type File -Path $env:TinySQLitePath
- name: Print MySQL, PostgreSQL database versions
run: |
Expand Down Expand Up @@ -609,7 +607,7 @@ jobs:
-QtRootPath (Get-Item -Path $env:QT_PLUGIN_PATH).Parent.Parent.Parent
-QtVersion $env:TINY_QT_VERSION -QtSpec $env:TINY_QT_SPEC
-MySQLServerPath $env:TinyMySQLInstallationPath
-BuildPath '${{ runner.workspace }}'
-BuildPath $env:RUNNER_WORKSPACE
- name: Cache LLVM and Clang
id: llvm-cache
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux-qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: TinyORM prepare environment
run: |
runnerWorkPath=$(realpath '${{ runner.workspace }}/..')
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
sqlitePath="$runnerWorkPath/SQLite/$DB_SQLITE_DATABASE"
Expand Down Expand Up @@ -154,9 +154,9 @@ jobs:

- name: SQLite create TinyORM database
run: |
mkdir --parents "$(dirname '${{ env.TinySQLitePath }}')"
mkdir --parents "$(dirname "$TinySQLitePath")"
touch '${{ env.TinySQLitePath }}'
touch "$TinySQLitePath"
- name: Print MySQL, SQLite, PostgreSQL database versions
run: |
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/linux-qt6-drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:

- name: TinyORM prepare environment
run: |
runnerWorkPath=$(realpath '${{ runner.workspace }}/..')
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
# Parallel gcc to 3 and clang to 8 is maximum what my computer allows but I decided to use
Expand All @@ -104,7 +104,7 @@ jobs:
tinyormBuildFolder="build-$tinyormBuildName"
echo "TinyORMBuildFolder=$tinyormBuildFolder" >> $GITHUB_ENV
tinyormBuildTree="${{ runner.workspace }}/TinyORM-builds-cmake/$tinyormBuildFolder"
tinyormBuildTree="$RUNNER_WORKSPACE/TinyORM-builds-cmake/$tinyormBuildFolder"
echo "TinyORMBuildTree=$tinyormBuildTree" >> $GITHUB_ENV
- name: MySQL service check status
Expand All @@ -123,7 +123,7 @@ jobs:
# Don't use the default CCACHE_DIR path on self-hosted runners
- name: Ccache prepare environment
run: |
ccacheDirPath='${{ runner.workspace }}/ccache'
ccacheDirPath="$RUNNER_WORKSPACE/ccache"
echo "CCACHE_DIR=$ccacheDirPath" >> $GITHUB_ENV
# I'm managing the ccache configuration manually on self-hosted runners using the ccache.conf
Expand All @@ -143,11 +143,11 @@ jobs:
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV
echo 'VCPKG_MAX_CONCURRENCY=${{ env.TinyParallel }}' >> $GITHUB_ENV
echo "VCPKG_MAX_CONCURRENCY=$TinyParallel" >> $GITHUB_ENV
- name: vcpkg needs upgrade? (once per day)
run: |
vcpkgUpgradedAtFilepath='${{ runner.workspace }}/.vcpkg_upgraded_at'
vcpkgUpgradedAtFilepath="$RUNNER_WORKSPACE/.vcpkg_upgraded_at"
if [ ! -f "$vcpkgUpgradedAtFilepath" ] || [ ! -r "$vcpkgUpgradedAtFilepath" ] || \
! read datePreviousUpgradeRaw < "$vcpkgUpgradedAtFilepath"
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
./bootstrap-vcpkg.sh
date +%Y-%m-%d > '${{ runner.workspace }}/.vcpkg_upgraded_at'
date +%Y-%m-%d > "$RUNNER_WORKSPACE/.vcpkg_upgraded_at"
- name: CMake print version
run: |
Expand All @@ -202,7 +202,7 @@ jobs:
- name: TinyORM create build folder (${{ env.TinyORMBuildName }})
run: |
mkdir --parents '${{ env.TinyORMBuildTree }}'
mkdir --parents "$TinyORMBuildTree"
- name: Ccache clear statistics
run: |
Expand All @@ -217,7 +217,7 @@ jobs:
cmake
--log-level=DEBUG --log-context
-S .
-B '${{ env.TinyORMBuildTree }}'
-B "$TinyORMBuildTree"
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache
-D CMAKE_CXX_COMPILER:FILEPATH=${{ matrix.compiler.command }}
Expand All @@ -242,7 +242,7 @@ jobs:
- name: TinyORM cmake build ✨ (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMBuildTree }}
run: |
cmake --build . --target all --parallel ${{ env.TinyParallel }}
cmake --build . --target all --parallel $TinyParallel
- name: Ccache print statistics
run: |
Expand Down Expand Up @@ -318,8 +318,8 @@ jobs:
if: matrix.compiler.key == 'gcc14' && matrix.drivers-type == 'Static' && matrix.build-type.key == 'release'
working-directory: ${{ env.TinyORMBuildTree }}/tests/testdata_tom
run: |
mkdir -p '${{ runner.workspace }}/.local/bin'
cp --force --target-directory='${{ runner.workspace }}/.local/bin' ./tom_testdata
mkdir -p "$RUNNER_WORKSPACE/.local/bin"
cp --force --target-directory="$RUNNER_WORKSPACE/.local/bin" ./tom_testdata
# The reason for this is the concurrency:group: can contain only two in_progress workflows,
# one will be in_progress and the second will be queued (waiting until the first finish),
Expand All @@ -337,7 +337,7 @@ jobs:
--jq '.[] | select (.path | endswith("/vcpkg-linux.yml")) | .state')
if [ $? -eq 0 ] && [[ "$workflowState" == 'active' ]]; then
gh workflow run vcpkg-linux.yml --ref ${{ github.ref_name }}
gh workflow run vcpkg-linux.yml --ref "$GITHUB_REF_NAME"
fi
env:
GH_TOKEN: ${{ github.token }}
10 changes: 5 additions & 5 deletions .github/workflows/linux-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: TinyORM prepare environment
run: |
runnerWorkPath=$(realpath '${{ runner.workspace }}/..')
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
sqlitePath="$runnerWorkPath/SQLite/$DB_SQLITE_DATABASE"
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
- name: PostgreSQL SSL certificates initialize
id: openssl-initialize-postgresql-certificates
run: |
folderPath='${{ env.TinyRunnerWorkPath }}/tiny-postgresql-certificates'
folderPath="$TinyRunnerWorkPath/tiny-postgresql-certificates"
# Create an empty folder for generating certificates
sudo mkdir "$folderPath"
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
- name: MySQL SSL certificates initialize
id: openssl-initialize-mysql-certificates
run: |
folderPath='${{ env.TinyRunnerWorkPath }}/tiny-mysql-certificates'
folderPath="$TinyRunnerWorkPath/tiny-mysql-certificates"
# Create an empty folder for generating certificates
sudo mkdir "$folderPath"
Expand Down Expand Up @@ -514,9 +514,9 @@ jobs:

- name: SQLite create TinyORM database
run: |
mkdir --parents "$(dirname '${{ env.TinySQLitePath }}')"
mkdir --parents "$(dirname "$TinySQLitePath")"
touch '${{ env.TinySQLitePath }}'
touch "$TinySQLitePath"
- name: Print MySQL, SQLite, PostgreSQL database versions
run: |
Expand Down
Loading

0 comments on commit 44b2f28

Please sign in to comment.