Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: fix Windows caching #4274

Merged
merged 2 commits into from
Sep 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,6 @@ jobs:
artifact-windows-win64: ${{ steps.prepare_deploy.outputs.artifact-windows-win64 }}
steps:

- name: "[Windows] Install rsync and openssh"
if: runner.os == 'Windows'
run: |
$Env:PATH="c:\msys64\usr\bin;$Env:PATH"
pacman -S --noconfirm coreutils bash rsync openssh
# Unfortunately, mixing executables from msys64 and mingw (i.e. Git
# Bash) does not work properly and leads to errors like these:
#
# 0 [main] python3 (5248) C:\msys64\usr\bin\python3.exe: *** fatal error - cygheap base mismatch detected - 0x180347408/0x180352408.
#
# Even when prepending the MSYS2 binary directory to %PATH%, GitHub
# Actions will still pick the Git Bash executable over the MSYS2 one
# when using `shell: bash`. Since it's not feasible to set `shell` to
# an absolute path in a cross-platform build workflow, we overwrite the
# git bash executable with the MSYS2 one.
#
# Also see related issue:
# https://github.com/actions/virtual-environments/issues/594
Copy-Item -Path "C:\msys64\usr\bin\bash.exe" -Destination "C:\Program Files\Git\bin\bash.exe" -Force
# By default, MSYS2 uses an
# /etc/profile file that changes
# the current working directory
# when bash is started. We don't
# want this behavior,so we just
# delete it.
Remove-Item -Path "C:\msys64\etc\profile"
# Add MSYS2's tools to %PATH%.
Add-Content -Path "$Env:GITHUB_ENV" -Value "PATH=$Env:PATH"

# sccache's handling of the /fp:fast MSVC compiler option is broken, so use our fork with the fix.
# https://github.com/mozilla/sccache/issues/950
- name: "[Windows] Set up cargo cache"
Expand Down Expand Up @@ -384,6 +355,39 @@ jobs:
--dest-url 'https://downloads.mixxx.org'
${{ matrix.artifacts_path }}

# Warning: do not move this step before restoring caches or it will break caching due to
# https://github.com/actions/cache/issues/531
- name: "[Windows] Install rsync and openssh"
env:
SSH_PRIVATE_KEY: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY }}
if: runner.os == 'Windows' && github.event_name == 'push' && env.SSH_PRIVATE_KEY != null
run: |
$Env:PATH="c:\msys64\usr\bin;$Env:PATH"
pacman -S --noconfirm coreutils bash rsync openssh
# Unfortunately, mixing executables from msys64 and mingw (i.e. Git
# Bash) does not work properly and leads to errors like these:
#
# 0 [main] python3 (5248) C:\msys64\usr\bin\python3.exe: *** fatal error - cygheap base mismatch detected - 0x180347408/0x180352408.
#
# Even when prepending the MSYS2 binary directory to %PATH%, GitHub
# Actions will still pick the Git Bash executable over the MSYS2 one
# when using `shell: bash`. Since it's not feasible to set `shell` to
# an absolute path in a cross-platform build workflow, we overwrite the
# git bash executable with the MSYS2 one.
#
# Also see related issue:
# https://github.com/actions/virtual-environments/issues/594
Copy-Item -Path "C:\msys64\usr\bin\bash.exe" -Destination "C:\Program Files\Git\bin\bash.exe" -Force
# By default, MSYS2 uses an
# /etc/profile file that changes
# the current working directory
# when bash is started. We don't
# want this behavior,so we just
# delete it.
Remove-Item -Path "C:\msys64\etc\profile"
# Add MSYS2's tools to %PATH%.
Add-Content -Path "$Env:GITHUB_ENV" -Value "PATH=$Env:PATH"

- name: "Set up SSH Agent"
if: github.event_name == 'push' && env.SSH_PRIVATE_KEY != null
shell: bash
Expand Down