Search code examples
github-actionsmiktex

Install problem MiKTeX under GitHub Actions


Since around October 16 2022 we have problems with installing MiKTeX under GitHub Actions. The error we get is:

Run ./miktexsetup_standalone --local-package-repository=C:/miktex-repository \
  ./miktexsetup_standalone --local-package-repository=C:/miktex-repository \
                --package-set=essential \
                --shared \
                install
  shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
initexmf.exe: The executed process did not succeed.
initexmf.exe: Data: fileName="C:\Program Files\MiKTeX\miktex\bin\x64\initexmf.exe", exitCode="1"
Error: Process completed with exit code 1.

The procedure followed in GitHub Actions consists of a few steps:

Step 1:

    - name: Download MikTex (Windows)
      run: |
        $wc = New-Object System.Net.WebClient;
        $maxAttempts=5;
        $attemptCount=0;
        Do {
          $attemptCount++;
          Try {
            $wc.DownloadFile("https://ctan.math.illinois.edu/systems/win32/miktex/setup/windows-x64/miktexsetup-5.1-x64.zip","miktexsetup-5.1-x64.zip")
          } Catch [Exception] {
            Write-Host $_.Exception | format-list -force
          }
        } while (((Test-Path "miktexsetup-5.1-x64.zip") -eq $false) -and ($attemptCount -le $maxAttempts))
      shell: pwsh
      if: matrix.config.os == 'windows-latest'

Step 2:

    - name: Extract MikTex zip (Windows)
      shell: bash
      run: |
        unzip miktexsetup-5.1-x64.zip
      if: matrix.config.os == 'windows-latest'

Step 3:

    - name: Download MikTex packages (Windows)
      shell: bash
      run: |
        ./miktexsetup_standalone --verbose \
                      --local-package-repository=C:/miktex-repository \
                      --remote-package-repository="https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/" \
                      --package-set=essential \
                      download
      if: matrix.config.os == 'windows-latest'

Step 4 (the failing step):

    - name: Install MikTex packages (Windows)
      shell: bash
      run: |
        ./miktexsetup_standalone --local-package-repository=C:/miktex-repository \
                      --package-set=essential \
                      --shared \
                      install
      if: matrix.config.os == 'windows-latest'

Step 5:

    - name: Setting MikTex paths (Windows)
      shell: bash
      run: |
        echo "C:/Program Files/MiKTeX/miktex/bin/x64/" >> $GITHUB_PATH
        export PATH="/c/Program Files/MiKTeX/miktex/bin/x64/:$PATH"

        echo "Configuring MiKTeX to install missing packages on the fly"
        initexmf --admin --verbose --set-config-value='[MPM]AutoInstall=1'
      if: matrix.config.os == 'windows-latest'

Any ideas how to solve this problem / what can be the problem?


Solution

  • Based on discussions in https://github.com/MiKTeX/miktex/discussions/1204 and https://github.com/MiKTeX/miktex/issues/1213 the solution is to replace the MiKTeX version's zip file

    from: miktexsetup-5.1-x64.zip

    to: miktexsetup-5.2.0+b8f430f-x64.zip