game-ci / unity-test-runner

Run tests for any Unity project
https://github.com/marketplace/actions/unity-test-runner
MIT License
205 stars 135 forks source link

Encountering "/steps/entrypoint.sh: No such file or directory" when running the action #284

Open Minimata opened 2 weeks ago

Minimata commented 2 weeks ago

Hello,

I'm trying to use Game CI's Github Actions on my Gitea server. The server is hosted using Docker and uses Gitea's act runner as a worker for Actions. The docker host is a CentOS on the cloud.

In that context, when using the unity-test-runner@v4 action, I quickly encounter an error following the docker command ran by the action: /bin/bash: line 1: /steps/entrypoint.sh: No such file or directory

Here is the full command that generates this error:

[command]/usr/bin/docker run 
--workdir /github/workspace 
--cidfile /tmp/container_4 
--rm 
--env UNITY_EMAIL=*** 
--env UNITY_PASSWORD=*** 
--env UNITY_SERIAL=*** 
--env UNITY_VERSION=2022.3.43f1 
--env PROJECT_PATH=. 
--env COVERAGE_OPTIONS=generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;dontClear 
--env COVERAGE_RESULTS_PATH=CodeCoverage 
--env ARTIFACTS_PATH=artifacts 
--env PACKAGE_MODE=false 
--env REGISTRY_SCOPES= 
--env RUN_AS_HOST_USER=true 
--env GITHUB_REF=refs/heads/main 
--env GITHUB_SHA=1ee52795300db287f4512e19dd1b22af592c7a75 
--env GITHUB_REPOSITORY=minimata/Unity-CICDTests 
--env GITHUB_ACTOR=minimata 
--env GITHUB_WORKFLOW=Run tests on the project 
--env GITHUB_EVENT_NAME=push 
--env GITHUB_ACTION=4 
--env GITHUB_EVENT_PATH=/var/run/act/workflow/event.json 
--env RUNNER_OS=Linux 
--env RUNNER_TOOL_CACHE=/opt/hostedtoolcache 
--env RUNNER_TEMP=/tmp 
--env GIT_CONFIG_EXTENSIONS 
--env TEST_PLATFORMS=playmode;editmode;COMBINE_RESULTS 
--env GITHUB_WORKSPACE=/github/workspace 
--volume /tmp/_github_home:/root:z 
--volume /tmp/_github_workflow:/github/workflow:z 
--volume /workspace/minimata/Unity-CICDTests:/github/workspace:z 
--volume /run/act/actions/game-ci-unity-test-runner@v4/dist/test-standalone-scripts:/UnityStandaloneScripts:z 
--volume /run/act/actions/game-ci-unity-test-runner@v4/dist/platforms/ubuntu:/steps:z 
--volume /run/act/actions/game-ci-unity-test-runner@v4/dist/unity-config:/usr/share/unity3d/config/:z 
--volume /run/act/actions/game-ci-unity-test-runner@v4/dist/BlankProject:/BlankProject:z 
--cpus=2 
--memory=2g 
--env USE_EXIT_CODE=false 
unityci/editor:2022.3.42f1-linux-il2cpp-3 /bin/bash -c /steps/entrypoint.sh

I think it's a permission error because the files do exist on the host and the volume is correctly bound at this point in the command --volume /run/act/actions/game-ci-unity-test-runner@v4/dist/platforms/ubuntu:/steps:z. Therefore, the entrypoint.sh should be in the launched container but the No such file or directory error can be raised even though the file exists but the process doesn't have the right to execute it, which is why I think this is the issue there.

However, I couldn't find a way to give this permission to the created container. Here a few things I tried:

I have read through the documentation and searched the indexed internet for an answer but couldn't really find anything useful. Maybe someone here will have an idea of what's the issue or a workaround?

Thanks!

How to reproduce

Gitea instance docker setup a bit simplified to stay as concise as possible

  gitea:
    image: gitea/gitea:1.21
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=gitea_db:5432
      - GITEA__database__NAME=${GITEA_DB_NAME}
      - GITEA__database__USER=${GITEA_DB_USER}
      - GITEA__database__PASSWD=${GITEA_DB_PASSWORD}
    volumes:
      - ./gitea:/data
      - /home/git/.ssh:/data/git/.ssh
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 127.0.0.1:2222:22

  gitea_db:
    image: postgres:16
    environment:
      - POSTGRES_USER=${GITEA_DB_USER}
      - POSTGRES_PASSWORD=${GITEA_DB_PASSWORD}
      - POSTGRES_DB=${GITEA_DB_NAME}
    volumes:
      - ./gitea-postgres:/var/lib/postgresql/data

  gitea_runner:
    image: gitea/act_runner:nightly
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./gitea-runner:/config
    environment:
      - GITEA_INSTANCE_URL=${HTTP_SCHEME}://${GITEA_SUBDOMAIN}.${DOMAIN_NAME}
      - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN}
      - CONFIG_FILE=/config/config.yaml

Workflow file a bit simplified to stay as concise as possible

name: Run tests on the project
on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest

    services:
      docker:
        image: docker:dind
        options: --privileged
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock

    steps:
      - name: Install necessities
        run: |
          apt update
          apt install -y docker.io   

      - name: Checkout
        uses: actions/checkout@v4
        with:
          lfs: true

      # Cache
      - uses: actions/cache@v3
        with:
          path: Library
          key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-

      # Test
      - name: Run tests
        uses: game-ci/unity-test-runner@v4
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          githubToken: ${{ secrets.TOKEN }}
          customImage: 'unityci/editor:2022.3.42f1-linux-il2cpp-3'
          runAsHostUser: true
          dockerCpuLimit: 2
          dockerMemoryLimit: 2g

The command forged by the unity-test-runner action should find the /steps/entrypoint.sh file and be able to launch it.