Переглянути джерело

[ci] fix windows CI (#11183)

* Revert "[ci] disable win32 while we fix it"

This reverts commit f06ad6402862e5553b6a8a3a218bc2e9d8d27412.

* [ci] dirty hack for win32

* [ci] restore windows installer

* [ci] check if windows artifacts are generated
Rudy Ges 2 роки тому
батько
коміт
4de9f47862

+ 80 - 16
.github/workflows/main.yml

@@ -18,7 +18,26 @@ jobs:
         with:
           submodules: recursive
 
-      # @import cache-opam-windows.yml
+      - name: Use GNU Tar from msys
+        run: |
+          echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+          rm C:\msys64\usr\bin\bash.exe
+
+      - name: choco install nsis
+        uses: nick-invision/retry@v1
+        with:
+          timeout_minutes: 10
+          max_attempts: 10
+          command: choco install --no-progress nsis.portable --version 3.02 -y
+
+      - name: choco install things
+        shell: pwsh
+        run: choco install --no-progress curl wget 7zip.portable -y
+
+      - name: Prepend Chocolatey path
+        shell: pwsh
+        run: Write-Host "::add-path::C:\ProgramData\chocolatey\bin"
+
       - name: Install Neko from S3
         shell: pwsh
         run: |
@@ -53,7 +72,6 @@ jobs:
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz')
 
       - name: Install OCaml libraries
-        # if: steps.cache-opam.outputs.cache-hit != 'true'
         shell: pwsh
         run: |
           Set-PSDebug -Trace 1
@@ -88,6 +106,13 @@ jobs:
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && ls ./out')
 
+      - name: Check artifact
+        shell: bash
+        run: |
+          ls out
+          # Output should contain binaries zip, installer zip and nupkg
+          [ $(ls -1 out | wc -l) -eq "3" ]
+
       - name: Upload artifact
         uses: actions/[email protected]
         with:
@@ -97,7 +122,6 @@ jobs:
 
   windows-build:
     runs-on: windows-latest
-    if: false
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       PLATFORM: windows
@@ -109,7 +133,26 @@ jobs:
         with:
           submodules: recursive
 
-      # @import cache-opam-windows.yml
+      - name: Use GNU Tar from msys
+        run: |
+          echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+          rm C:\msys64\usr\bin\bash.exe
+
+      - name: choco install nsis
+        uses: nick-invision/retry@v1
+        with:
+          timeout_minutes: 10
+          max_attempts: 10
+          command: choco install --no-progress nsis.portable --version 3.02 -y
+
+      - name: choco install things
+        shell: pwsh
+        run: choco install --no-progress curl wget 7zip.portable -y
+
+      - name: Prepend Chocolatey path
+        shell: pwsh
+        run: Write-Host "::add-path::C:\ProgramData\chocolatey\bin"
+
       - name: Install Neko from S3
         shell: pwsh
         run: |
@@ -123,6 +166,23 @@ jobs:
         run: neko -version 2>&1
 
       - name: Setup ocaml
+        id: ocaml
+        continue-on-error: true
+        uses: kLabz/setup-ocaml@win32
+        with:
+          ocaml-compiler: 4.08.1
+          opam-depext: false
+          opam-repositories: |
+            opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
+            default: https://github.com/ocaml/opam-repository.git
+          opam-local-packages: |
+            haxe.opam
+          cache-prefix: w32-v1
+
+      # TODO make it work on first try
+      # (when cygwin cache doesn't exist, ocaml install fails with a curl error)
+      - name: Setup ocaml (second chance)
+        if: steps.ocaml.outcome == 'failure'
         uses: kLabz/setup-ocaml@win32
         with:
           ocaml-compiler: 4.08.1
@@ -146,7 +206,6 @@ jobs:
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz')
 
       - name: Install OCaml libraries
-        # if: steps.cache-opam.outputs.cache-hit != 'true'
         shell: pwsh
         run: |
           Set-PSDebug -Trace 1
@@ -181,6 +240,13 @@ jobs:
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
           & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && ls ./out')
 
+      - name: Check artifact
+        shell: bash
+        run: |
+          ls out
+          # Output should contain binaries zip, installer zip and nupkg
+          [ $(ls -1 out | wc -l) -eq "3" ]
+
       - name: Upload artifact
         uses: actions/[email protected]
         with:
@@ -867,8 +933,7 @@ jobs:
 
   deploy:
     if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
-    needs: [linux-test, linux-arm64, mac-test, windows64-test]
-    # needs: [linux-test, linux-arm64, mac-test, windows-test, windows64-test]
+    needs: [linux-test, linux-arm64, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-20.04
     steps:
       # this is only needed for to get `COMMIT_DATE`...
@@ -911,9 +976,9 @@ jobs:
           aws s3 cp win64Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows64/${FILE_NAME}.zip
           aws s3 cp win64Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows64-installer/${FILE_NAME}.zip
           aws s3 cp win64Binaries/*.nupkg           ${HXBUILDS_S3ADDR}/haxe/windows64-choco/
-          # aws s3 cp win32Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows/${FILE_NAME}.zip
-          # aws s3 cp win32Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows-installer/${FILE_NAME}.zip
-          # aws s3 cp win32Binaries/*.nupkg           ${HXBUILDS_S3ADDR}/haxe/windows-choco/
+          aws s3 cp win32Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows/${FILE_NAME}.zip
+          aws s3 cp win32Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows-installer/${FILE_NAME}.zip
+          aws s3 cp win32Binaries/*.nupkg           ${HXBUILDS_S3ADDR}/haxe/windows-choco/
 
       - name: Update "latest"
         if: github.ref == 'refs/heads/development'
@@ -931,21 +996,20 @@ jobs:
           aws s3 cp macBinaries/*_installer.tar.gz  ${HXBUILDS_S3ADDR}/haxe/mac-installer/haxe_latest.tar.gz
           aws s3 cp win64Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows64/haxe_latest.zip
           aws s3 cp win64Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows64-installer/haxe_latest.zip
-          # aws s3 cp win32Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows/haxe_latest.zip
-          # aws s3 cp win32Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows-installer/haxe_latest.zip
+          aws s3 cp win32Binaries/*_bin.zip         ${HXBUILDS_S3ADDR}/haxe/windows/haxe_latest.zip
+          aws s3 cp win32Binaries/*_installer.zip   ${HXBUILDS_S3ADDR}/haxe/windows-installer/haxe_latest.zip
 
           # Chocolatey packages have to be named with version number,
           # so let's use web redirection to keep the original file name.
           [[ "$HXBUILDS_S3ADDR" =~ s3://([^/]+)(.*) ]] && HXBUILDS_S3BUCKET="${BASH_REMATCH[1]}" && HXBUILDS_S3PATH="${BASH_REMATCH[2]}"
           [[ `echo win64Binaries/*.nupkg` =~ win64Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
           aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows64-choco/${FILE_NAME} ${HXBUILDS_S3ADDR}/haxe/windows64-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows64-choco/${FILE_NAME}"
-          # [[ `echo win32Binaries/*.nupkg` =~ win32Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
-          # aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows-choco/${FILE_NAME}   ${HXBUILDS_S3ADDR}/haxe/windows-choco/haxe_latest.nupkg   --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
+          [[ `echo win32Binaries/*.nupkg` =~ win32Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
+          aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows-choco/${FILE_NAME}   ${HXBUILDS_S3ADDR}/haxe/windows-choco/haxe_latest.nupkg   --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
 
   deploy_apidoc:
     if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
-    needs: [linux-test, linux-arm64, mac-test, windows64-test]
-    # needs: [linux-test, linux-arm64, mac-test, windows-test, windows64-test]
+    needs: [linux-test, linux-arm64, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-20.04
     steps:
       - name: Install dependencies

+ 1 - 1
Makefile.win

@@ -83,7 +83,7 @@ package_choco:
 	rm -rf out/choco
 
 $(INSTALLER_TMP_DIR)/neko-win.zip: $(INSTALLER_TMP_DIR)
-	wget -nv https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-win$(NEKO_ARCH_STR).zip -O installer/neko-win.zip
+	curl -L https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-win$(NEKO_ARCH_STR).zip -o installer/neko-win.zip
 
 package_installer_win: $(INSTALLER_TMP_DIR)/neko-win.zip package_win
 	$(eval OUTFILE := $(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_installer.zip)

+ 7 - 0
extra/github-actions/build-windows.yml

@@ -26,6 +26,13 @@
     & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
     & "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && ls ./out')
 
+- name: Check artifact
+  shell: bash
+  run: |
+    ls out
+    # Output should contain binaries zip, installer zip and nupkg
+    [ $(ls -1 out | wc -l) -eq "3" ]
+
 - name: Upload artifact
   uses: actions/[email protected]
   with:

+ 14 - 0
extra/github-actions/install-nsis.yml

@@ -0,0 +1,14 @@
+- name: choco install nsis
+  uses: nick-invision/retry@v1
+  with:
+    timeout_minutes: 10
+    max_attempts: 10
+    command: choco install --no-progress nsis.portable --version 3.02 -y
+
+- name: choco install things
+  shell: pwsh
+  run: choco install --no-progress curl wget 7zip.portable -y
+
+- name: Prepend Chocolatey path
+  shell: pwsh
+  run: Write-Host "::add-path::C:\ProgramData\chocolatey\bin"

+ 0 - 1
extra/github-actions/install-ocaml-libs-windows.yml

@@ -1,5 +1,4 @@
 - name: Install OCaml libraries
-  # if: steps.cache-opam.outputs.cache-hit != 'true'
   shell: pwsh
   run: |
     Set-PSDebug -Trace 1

+ 17 - 0
extra/github-actions/install-ocaml-windows.yml

@@ -1,4 +1,21 @@
 - name: Setup ocaml
+  id: ocaml
+  continue-on-error: true
+  uses: kLabz/setup-ocaml@win32
+  with:
+    ocaml-compiler: 4.08.1
+    opam-depext: false
+    opam-repositories: |
+      opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
+      default: https://github.com/ocaml/opam-repository.git
+    opam-local-packages: |
+      haxe.opam
+    cache-prefix: w32-v1
+
+# TODO make it work on first try
+# (when cygwin cache doesn't exist, ocaml install fails with a curl error)
+- name: Setup ocaml (second chance)
+  if: steps.ocaml.outcome == 'failure'
   uses: kLabz/setup-ocaml@win32
   with:
     ocaml-compiler: 4.08.1

+ 12 - 2
extra/github-actions/workflows/main.yml

@@ -17,7 +17,12 @@ jobs:
         with:
           submodules: recursive
 
-      # @import cache-opam-windows.yml
+      - name: Use GNU Tar from msys
+        run: |
+          echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+          rm C:\msys64\usr\bin\bash.exe
+
+      @import install-nsis.yml
       @import install-neko-windows.yml
       @import install-ocaml-windows64.yml
       @import install-ocaml-libs-windows.yml
@@ -36,7 +41,12 @@ jobs:
         with:
           submodules: recursive
 
-      # @import cache-opam-windows.yml
+      - name: Use GNU Tar from msys
+        run: |
+          echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+          rm C:\msys64\usr\bin\bash.exe
+
+      @import install-nsis.yml
       @import install-neko-windows.yml
       @import install-ocaml-windows.yml
       @import install-ocaml-libs-windows.yml