actions / upload-artifact

MIT License
3.16k stars 710 forks source link

[bug] Unable to download produced artifacts #417

Closed sabaimran closed 9 months ago

sabaimran commented 1 year ago

What happened?

Hi all, this has been happening consistently all day today.

I've run an action that outputs an application via pyinstaller. It packages this application dependent on OS and outputs it as a build artifact. This generally works fine, but today I've been unable to download the outputted artifact. But it is outputting something with the correct file names.

See this example from an action run.

What did you expect to happen?

I expected that the artifact that was uploaded to the action would be downloadable. Instead, when I click or try to download the output, it would spend a long time (excess of 30 minutes) loading, waiting for the download to start, before my browser or CLI would give up.

Note that this is a job we've had for a while, but just started running into the issue today.

I don't suspect that the issue is actually with this action itself. It seems like something else, but I figured y'all might be able to help me debug.

How can we reproduce it?

You can run gh run download 5626542312 to see your CLI wait for a long time without any response.

Here's a link to one of the jobs that are affected by this issue: https://github.com/khoj-ai/khoj/actions/runs/5625833399

Here's the raw code for the job:

name: desktop_dev_build

on:
  push:
    branches:
      - master
    paths:
      - src/khoj/**
      - pyproject.toml
      - Khoj.spec
  workflow_dispatch:

jobs:
  publish_desktop_apps:
    name: 🖥️ Publish Desktop Apps

    strategy:
      matrix:
        include:
        - os: ubuntu-latest
          extension: deb
        - os: macos-latest
          extension: dmg
        - os: windows-latest
          extension: exe

    runs-on: ${{ matrix.os }}
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3

      - name: Set up Python 3.9
        uses: actions/setup-python@v4
        with:
          python-version: '3.9'

      - name: ⏬️ Install Dependencies
        shell: bash
        run: |
          if [ "$RUNNER_OS" == "Linux" ]; then
            sudo apt install libegl1 libxcb-xinerama0 python3-tk -y
          fi
          python -m pip install --upgrade pip
          pip install pyinstaller

      - name: ⬇️ Install Khoj App
        run: |
          pip install --upgrade .

      - name: 📦 Package Khoj App
        shell: bash
        run: |
          # Setup Environment for Reproducible Builds
          export PYTHONHASHSEED=42
          export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)

          pyinstaller --noconfirm Khoj.spec
          if [ "$RUNNER_OS" == "Windows" ]; then
            mv dist/Khoj.exe dist/khoj_dev_amd64.exe
          fi

      - name: 💻 Create Mac App DMG
        if: matrix.os == 'macos-latest'
        run: |
         # Install Mac DMG Creator
          brew install create-dmg
          # Copy app to separate dmg folder
          mkdir -p dist/dmg && cp -r dist/Khoj.app dist/dmg
          # Create disk image with the app
          create-dmg \
            --volname "Khoj" \
            --volicon "src/khoj/interface/web/assets/icons/favicon.icns" \
            --window-pos 200 120 \
            --window-size 600 300 \
            --icon-size 100 \
            --icon "Khoj.app" 175 120 \
            --hide-extension "Khoj.app" \
            --app-drop-link 425 120 \
            "dist/khoj_dev_amd64.dmg" \
            "dist/dmg/"

      - uses: ruby/setup-ruby@v1
        if: matrix.os == 'ubuntu-latest'
        with:
          ruby-version: '3.0'

      - name: 🐧 Create Debian Package
        if: matrix.os == 'ubuntu-latest'
        shell: bash
        run: |
          # Install Debian Packager
          gem install fpm

          # Copy app files into expected output directory structure
          mkdir -p package/opt package/usr/share/applications package/usr/share/icons/hicolor/128x128/apps
          cp -r dist/Khoj package/opt/Khoj
          cp src/khoj/interface/web/assets/icons/favicon-128x128.png package/usr/share/icons/hicolor/128x128/apps/Khoj.png
          cp Khoj.desktop package/usr/share/applications

          # Fix permissions to be usable by non-root users
          find package/usr/share -type f -exec chmod 644 -- {} +
          chmod 755 package/opt/Khoj

          # Package the app
          fpm -C package -s dir -t deb -n Khoj -p dist/khoj_dev_amd64.deb

      - uses: actions/upload-artifact@v3
        with:
          name: khoj_dev_amd64.${{matrix.extension}}
          path: dist/khoj_dev_amd64.${{matrix.extension}}
          retention-days: 1

Anything else we need to know?

No response

What version of the action are you using?

v3.0.0

What are your runner environments?

linux, window, macos

Are you on GitHub Enterprise Server? If so, what version?

n/a

konradpabjan commented 9 months ago

We've released v4 upload-artifact today! https://github.blog/changelog/2023-12-14-github-actions-artifacts-v4-is-now-generally-available/

Recommend switching over as what you're describing should no longer happen. Uploads overall should be faster and more reliable and we even output a SHA256 value for the upload artifact.

In the UI when download artifacts, they should start instantly now and will always be consistent if the artifacts are uploaded using v4.

omuleanu commented 4 months ago

@konradpabjan still happens to me: https://github.com/omuleanu/ValueInjecter/actions/runs/9255968896

drivera-armedia commented 2 weeks ago

Still happens to me ... https://github.com/ArkCase/ark_base/actions/runs/10984649003 ... can see the artifacts, but can't download them ...