uraimo / run-on-arch-action

A Github Action that executes jobs/commands on non-x86 cpu architectures (ARMv6, ARMv7, aarch64, s390x, ppc64le, riscv64) via QEMU
BSD 3-Clause "New" or "Revised" License
665 stars 146 forks source link

linux/arm64/v8 does not match the detected host platform linux/amd64 #109

Closed salatielosorno closed 1 year ago

salatielosorno commented 1 year ago

I am getting the following message:

Warning: rning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
arm64-issue

Here is my yml file:

name: Build and Release
on:
  push:
    branches:
      - release/V1.0.0
    tags:
      - v*

jobs:
  build_on_linux:
    name: Linux (${{ matrix.os }} - ${{ matrix.arch }})
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ ubuntu-20.04 ]
        arch: [ aarch64 ]
        distro: [ ubuntu20.04 ]
    steps:
      - uses: actions/checkout@v2
      - uses: uraimo/run-on-arch-action@v2
        name: Run commands
        id: runcmd
        with:
          arch: ${{ matrix.arch }}
          distro: ${{ matrix.distro }}
          # Set an output parameter `uname` for use in subsequent steps
          run: |
            uname -a
            echo ::set-output name=uname::$(uname -a)
      - name: Install NodeJS and NPM
        run: sudo apt install nodejs -y && sudo apt install npm -y
      - name: NPM Version
        run: npm --version
      - name: install dependencies
        run: npm install
      - name: publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npm run publish

The workflows runs ok. However I need to build my application using arm64arch. Any idea what is happening?

uraimo commented 1 year ago

You can ignore it, it's the result of the internal docker being launched without specifying an architecture, because it depends from the one associated with the image being used.

salatielosorno commented 1 year ago

@uraimo Thanks for quickly answering. However, I am using Electron whose script called publish allow you to create the .deb file based on arch where script is running and I am getting an amd64 file instead of an arm64 file.

uraimo commented 1 year ago

Oh I see now, the problem is that you have added additional steps after the one using run-on-arch, you should add all those commands in the same run block, otherwise you exit the emulated context and go back to the original x64 host, i.e.:

    steps:
      - uses: actions/checkout@v2
      - uses: uraimo/run-on-arch-action@v2
        name: Run commands
        id: runcmd
        with:
          arch: ${{ matrix.arch }}
          distro: ${{ matrix.distro }}
          env: |
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            uname -a
            echo ::set-output name=uname::$(uname -a)
            apt-get update -q -y
            sudo apt install nodejs -y && sudo apt install npm -y
            npm --version
            npm install
            npm run publish
salatielosorno commented 1 year ago

@uraimo Thanks, I can see my error 😅 I am facing other issues but I think they lies on my code. Thanks for your quick answering.