From 1d8b313485d586d411f69bf886f619327e8e0659 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Fri, 19 Apr 2024 12:55:32 +0200 Subject: [PATCH] Try fix Windows caching (#133) * Try fix caching * Try fix cache path * Try include cobolcheck * Try include cobolcheck * Use home dir * Use home dir --- .github/workflows/test-windows.yml | 16 ++++++++-------- bin/fetch-cobolcheck.ps1 | 4 +++- bin/setup-environment.ps1 | 16 +++++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index cc1d1cf7..fc7d4c37 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -31,10 +31,12 @@ jobs: - name: Cache GnuCOBOL id: cache-gnu-cobol - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: - path: $HOME\gnucobol-3.2.7z - key: ${{ runner.os }}-gnu-cobol-3.2 + path: | + ~/gnucobol + ~/cobolcheck + key: gnucobol-3.2.7-cobolcheck-v1 - name: Download GnuCOBOL if: steps.cache-gnu-cobol.outputs.cache-hit != 'true' @@ -46,12 +48,10 @@ jobs: RetryIntervalSec = 1 } Invoke-WebRequest -Uri 'https://www.arnoldtrembley.com/GC32-BDB-SP1-rename-7z-to-exe.7z' -OutFile $HOME\gnucobol-3.2.7z @requestOpts + 7z x $HOME\gnucobol-3.2.7z -o"${HOME}\gnucobol" -y - - name: Extract GnuCOBOL - shell: pwsh - run: 7z x $HOME\gnucobol-3.2.7z -ognucobol -y - - - name: Fetch CobolCheck + - name: Download CobolCheck + if: steps.cache-gnu-cobol.outputs.cache-hit != 'true' shell: pwsh run: bin/fetch-cobolcheck.ps1 diff --git a/bin/fetch-cobolcheck.ps1 b/bin/fetch-cobolcheck.ps1 index a57f708d..3e9608d1 100644 --- a/bin/fetch-cobolcheck.ps1 +++ b/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/bin/setup-environment.ps1 b/bin/setup-environment.ps1 index 78117f92..b8e02dad 100644 --- a/bin/setup-environment.ps1 +++ b/bin/setup-environment.ps1 @@ -1,7 +1,9 @@ -$env:Path = "${env:GITHUB_WORKSPACE}\gnucobol\bin;${env:GITHUB_WORKSPACE}\bin;${env:Path}" -[System.Environment]::SetEnvironmentVariable('COB_CONFIG_DIR', "${env:GITHUB_WORKSPACE}\gnucobol\config") -[System.Environment]::SetEnvironmentVariable('COB_COPY_DIR', "${env:GITHUB_WORKSPACE}\gnucobol\copy") -[System.Environment]::SetEnvironmentVariable('COB_CFLAGS', "-I ${env:GITHUB_WORKSPACE}\gnucobol\include") -[System.Environment]::SetEnvironmentVariable('COB_LDFLAGS', "-L ${env:GITHUB_WORKSPACE}\gnucobol\lib") -[System.Environment]::SetEnvironmentVariable('COB_LIBRARY_PATH', "${env:GITHUB_WORKSPACE}\gnucobol\lib") -[System.Environment]::SetEnvironmentVariable('COB_LIBS', "${env:GITHUB_WORKSPACE}\gnucobol\bin\libcob-4.dll") +$gnucobolDir = "${HOME}\gnucobol" +$cobolcheckDir = "${HOME}\cobolcheck" +$env:Path = "${gnucobolDir}\bin;${cobolcheckDir};${env:Path}" +[System.Environment]::SetEnvironmentVariable('COB_CONFIG_DIR', "${gnucobolDir}\config") +[System.Environment]::SetEnvironmentVariable('COB_COPY_DIR', "${gnucobolDir}\copy") +[System.Environment]::SetEnvironmentVariable('COB_CFLAGS', "-I ${gnucobolDir}\include") +[System.Environment]::SetEnvironmentVariable('COB_LDFLAGS', "-L ${gnucobolDir}\lib") +[System.Environment]::SetEnvironmentVariable('COB_LIBRARY_PATH', "${gnucobolDir}\lib") +[System.Environment]::SetEnvironmentVariable('COB_LIBS', "${gnucobolDir}\bin\libcob-4.dll")