From 13d7be8a0eec8ccdb11ecc28c85cf464d67dc83b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 3 Jun 2021 20:56:05 +0200 Subject: [PATCH] Run some tests on the produced installers before uploading Install on both server 2016 and 2019, using the qt installer and the sfx inside docker This makes the nightly builds safer to use, since they are likely never completely broken. Fixes #27 --- .ci/Dockerfile.2016 | 13 +++ Dockerfile => .ci/Dockerfile.2019 | 7 +- .github/workflows/build.yml | 127 ++++++++++++++++++++++++------ 3 files changed, 120 insertions(+), 27 deletions(-) create mode 100644 .ci/Dockerfile.2016 rename Dockerfile => .ci/Dockerfile.2019 (51%) diff --git a/.ci/Dockerfile.2016 b/.ci/Dockerfile.2016 new file mode 100644 index 0000000..388d824 --- /dev/null +++ b/.ci/Dockerfile.2016 @@ -0,0 +1,13 @@ +FROM mcr.microsoft.com/windows/servercore:ltsc2016 + +COPY ./msys2-base-x86_64-latest.sfx.exe /msys2.exe + +RUN powershell -Command \ + $ErrorActionPreference = 'Stop'; \ + $ProgressPreference = 'SilentlyContinue'; \ + /msys2.exe -y -oC:\; \ + function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } \ + msys ' '; \ + msys 'pacman --noconfirm -Syuu'; \ + msys 'pacman --noconfirm -Syuu'; \ + msys 'pacman --noconfirm -Scc'; diff --git a/Dockerfile b/.ci/Dockerfile.2019 similarity index 51% rename from Dockerfile rename to .ci/Dockerfile.2019 index 2ee85e8..3e986ce 100644 --- a/Dockerfile +++ b/.ci/Dockerfile.2019 @@ -1,12 +1,11 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019 +COPY ./msys2-base-x86_64-latest.sfx.exe /msys2.exe + RUN powershell -Command \ $ErrorActionPreference = 'Stop'; \ $ProgressPreference = 'SilentlyContinue'; \ - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; \ - .\msys2.exe -y -oC:\; \ - Remove-Item msys2.exe ; \ + /msys2.exe -y -oC:\; \ function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } \ msys ' '; \ msys 'pacman --noconfirm -Syuu'; \ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c3f62f..20722f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,16 +42,119 @@ jobs: sha256sum.exe msys2-* sha256sum.exe msys2-* > msys2-checksums.txt + - name: Create 'latest' Variants + run: | + cp msys2-base-x86_64-[0-9]*.sfx.exe msys2-base-x86_64-latest.sfx.exe + cp msys2-x86_64-[0-9]*.exe msys2-x86_64-latest.exe + cp msys2-*.tar.xz msys2-base-x86_64-latest.tar.xz + - name: Upload Results uses: actions/upload-artifact@v2 with: name: installer path: msys2-* + test-installer-2019: + needs: build-installer + runs-on: windows-2019 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: installer + + - name: Install + run: | + ./msys2-x86_64-latest.exe in --confirm-command --accept-messages --root C:/msys2-install-test + + - name: Test + run: | + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman --version" + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman -Qkv" + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman -Syy" + + - name: Uninstall + run: | + C:\msys2-install-test\uninstall.exe pr --confirm-command + + test-installer-2016: + needs: build-installer + runs-on: windows-2016 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: installer + + - name: Install + run: | + ./msys2-x86_64-latest.exe in --confirm-command --accept-messages --root C:/msys2-install-test + + - name: Test + run: | + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman --version" + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman -Qkv" + C:\msys2-install-test\usr\bin\bash.exe -lc "pacman -Syy" + + - name: Uninstall + run: | + C:\msys2-install-test\uninstall.exe pr --confirm-command + + test-docker-sfx-2019: + needs: build-installer + runs-on: windows-2019 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: installer + + - name: Build image + run: | + docker build -t msys2-base -f ./.ci/Dockerfile.2019 . + + - name: Test + run: | + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman --version" + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman -Qkv" + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman -Syy" + + test-docker-sfx-2016: + needs: build-installer + runs-on: windows-2016 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: installer + + - name: Build image + run: | + docker build -t msys2-base -f ./.ci/Dockerfile.2016 . + + - name: Test + run: | + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman --version" + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman -Qkv" + docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman -Syy" + upload-nightly: permissions: contents: write - needs: build-installer + needs: + - build-installer + - test-docker-sfx-2019 + - test-docker-sfx-2016 + - test-installer-2016 + - test-installer-2019 if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: @@ -59,31 +162,9 @@ jobs: with: name: installer - - name: Create 'latest' Variants - run: | - cp msys2-base-x86_64-[0-9]*.sfx.exe msys2-base-x86_64-latest.sfx.exe - cp msys2-x86_64-[0-9]*.exe msys2-x86_64-latest.exe - cp msys2-*.tar.xz msys2-base-x86_64-latest.tar.xz - - uses: eine/tip@master with: token: ${{ secrets.GITHUB_TOKEN }} tag: nightly-x86_64 rm: true files: msys2-* - - build-docker: - needs: upload-nightly - if: github.ref == 'refs/heads/master' - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build image - run: | - Get-Content Dockerfile | docker build -t msys2-base - - - - name: Test - run: | - docker run msys2-base C:\msys64\usr\bin\bash.exe -lc "pacman --version"