Why github actions artifact not uploading files if it's inside .gitignore?

Hi,

I want to run my Appium tests in github actions where it will upload the apps and media files as artifacts and download those before running the tests.

The problem is both ios and Android apps’ sizes are more than 300 Mb. And I have added the apps folder in my .gitignore file. As a result, while uploading artifacts from the apps folder, it’s not finding any files. And I don’t want to use git LFS.

How can I overcome this issue? My yml file given below:

name: trigger appium tests
run-name: ${{github.actor}} has triggered the workflow
on: [push]
jobs:
  run-mobile-tests:
    runs-on: macos-latest
    steps:
      - name: setup Java 11
        uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '11'
      - name: Pull the codebase in the test runner
        uses: actions/checkout@v3

      - name: Delete .gitignore files
        run: sudo find . -name ".gitignore" -delete

      - name: Upload App Files as Artifacts
        uses: actions/upload-artifact@v2
        with:
          name: app-files
          path: |
            apps/androidRespond.apk
            apps/iOS-Simulator-MyRNDemoApp.1.3.0-162.zip
      - name: Setup appium
        run: |
          npm i --location=global appium
          appium --version
          appium driver install uiautomator2
          appium &>/dev/null &



      - name: Restore Maven cache
        uses: skjolber/maven-cache-github-action@v1
        with:
          step: restore
        continue-on-error: true

      - name: Download App Files
        uses: actions/download-artifact@v2
        with:
          name: app-files
          path: apps/

      - name: Setup Emulator
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 29
          script: mvn clean test

      - name: Save Maven cache
        uses: skjolber/maven-cache-github-action@v1
        with:
          step: save
        continue-on-error: true
2 Likes

Not an expert but are you running the action on your own machine(aka self-hosted runner) or on a github-hosted runner?

If it’s the latter, then I believe it’s because you add the apps folder to .gitignore, then the apps folder is never committed to the repo.
When the github-hosted runner retrieve the repo, the apps folder is not available.

What error are you getting anyway? Or at which steps?

1 Like

Hi mtest, thank you for replying.

You are right, I am trying to run it on github action container, hence it’s not fetching the apps folder because it’s added to my .gitignore file. Once I remove the apps folder from my gitignore file, it works and the file gets uploaded to the artifact.

But I don’t want to push big files (apps) in my repository using Git LFS, is there any way around it? Or this is not possible?

Can I upload my apps to cloud storage like drive/dropbox and download from their while running the test in Github Actions? Is that possible? If yes, can you provide me the yml steps for this job?

Can you not build the app in the action container?

I am not familiar with GitHub actions command but I know in Azure Devops, you can run bash/powershell command to do things in container. I believe you can do the same GitHub actions (just have to google for the right syntax).

1 Like