From 3005c8dec688c842c1faddfc51913e93476781e8 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 3 Jun 2024 13:29:19 +0800 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! ci(windows/gnu): install `mingw` via `msys2/setup-msys2` --- .github/workflows/ci.yaml | 39 +++++++++++++------ .../windows-builds-template.yaml | 13 +++++-- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3aebc9ade21..401f08ba6fd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -68,18 +68,23 @@ jobs: if: matrix.mingwdir != '' run: | import os - paths = [ r'C:\msys64\${{ matrix.mingwdir }}\bin', r'C:\msys64\usr\bin', ] - with open(os.environ["GITHUB_PATH"], "a") as f: - for path in paths: - f.write(path + "\n") + excluded = { + r'C:\mingw64\bin', + } + with open(os.environ["GITHUB_PATH"], "r+") as fp: + lines = fp.readlines() + lines = paths + [l for l in lines if l not in excluded] + fp.seek(0) + fp.writelines(lines) - name: Verify mingw gcc installation shell: powershell if: matrix.mingwdir != '' run: | + choco uninstall -y strawberryperl Get-Command ${{ matrix.gcc }} - name: Set PATH run: | @@ -223,18 +228,23 @@ jobs: if: matrix.mingwdir != '' run: | import os - paths = [ r'C:\msys64\${{ matrix.mingwdir }}\bin', r'C:\msys64\usr\bin', ] - with open(os.environ["GITHUB_PATH"], "a") as f: - for path in paths: - f.write(path + "\n") + excluded = { + r'C:\mingw64\bin', + } + with open(os.environ["GITHUB_PATH"], "r+") as fp: + lines = fp.readlines() + lines = paths + [l for l in lines if l not in excluded] + fp.seek(0) + fp.writelines(lines) - name: Verify mingw gcc installation shell: powershell if: matrix.mingwdir != '' run: | + choco uninstall -y strawberryperl Get-Command ${{ matrix.gcc }} - name: Set PATH run: | @@ -384,18 +394,23 @@ jobs: if: matrix.mingwdir != '' run: | import os - paths = [ r'C:\msys64\${{ matrix.mingwdir }}\bin', r'C:\msys64\usr\bin', ] - with open(os.environ["GITHUB_PATH"], "a") as f: - for path in paths: - f.write(path + "\n") + excluded = { + r'C:\mingw64\bin', + } + with open(os.environ["GITHUB_PATH"], "r+") as fp: + lines = fp.readlines() + lines = paths + [l for l in lines if l not in excluded] + fp.seek(0) + fp.writelines(lines) - name: Verify mingw gcc installation shell: powershell if: matrix.mingwdir != '' run: | + choco uninstall -y strawberryperl Get-Command ${{ matrix.gcc }} - name: Set PATH run: | diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 141b084ce45..57f981cb3f6 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -62,18 +62,23 @@ jobs: # skip-master skip-pr skip-stable if: matrix.mingwdir != '' run: | import os - paths = [ r'C:\msys64\${{ matrix.mingwdir }}\bin', r'C:\msys64\usr\bin', ] - with open(os.environ["GITHUB_PATH"], "a") as f: - for path in paths: - f.write(path + "\n") + excluded = { + r'C:\mingw64\bin', + } + with open(os.environ["GITHUB_PATH"], "r+") as fp: + lines = fp.readlines() + lines = paths + [l for l in lines if l not in excluded] + fp.seek(0) + fp.writelines(lines) - name: Verify mingw gcc installation shell: powershell if: matrix.mingwdir != '' run: | + choco uninstall -y strawberryperl Get-Command ${{ matrix.gcc }} - name: Set PATH run: |