{"id":21974279,"url":"https://github.com/frequenz-floss/gh-action-run-python-in-qemu","last_synced_at":"2026-04-12T19:31:41.548Z","repository":{"id":224019390,"uuid":"762182092","full_name":"frequenz-floss/gh-action-run-python-in-qemu","owner":"frequenz-floss","description":"runs a custom script in a cross-arch Python environment using QEMU and Docker for emulation/containerization.","archived":false,"fork":false,"pushed_at":"2024-02-23T10:24:19.000Z","size":6,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"v0.x.x","last_synced_at":"2025-01-28T03:17:19.828Z","etag":null,"topics":["action","cross-architecture","docker","gh-action","github","python","qemu"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frequenz-floss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-23T08:50:20.000Z","updated_at":"2024-02-23T10:25:26.000Z","dependencies_parsed_at":"2024-11-29T15:43:09.114Z","dependency_job_id":"5ecd3495-c504-4feb-9b6d-50537e278d1b","html_url":"https://github.com/frequenz-floss/gh-action-run-python-in-qemu","commit_stats":null,"previous_names":["frequenz-floss/gh-action-run-python-in-qemu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Fgh-action-run-python-in-qemu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Fgh-action-run-python-in-qemu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Fgh-action-run-python-in-qemu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Fgh-action-run-python-in-qemu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frequenz-floss","download_url":"https://codeload.github.com/frequenz-floss/gh-action-run-python-in-qemu/tar.gz/refs/heads/v0.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245034000,"owners_count":20550375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","cross-architecture","docker","gh-action","github","python","qemu"],"created_at":"2024-11-29T15:40:38.740Z","updated_at":"2026-04-12T19:31:41.541Z","avatar_url":"https://github.com/frequenz-floss.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Run a script in a cross-arch Python environment\n\nThis action runs a custom script in a cross-arch Python environment using\n[QEMU][qemu] and [Docker][docker] for emulation/containerization.\n\nBy default an Ubuntu-based environment is used, but you can use a custom\n`Dockerfile` to use a different OS.\n\n## Security considerations\n\nThis action executes a repository-provided script and can optionally build from\na repository-provided `Dockerfile`. Treat both as trusted code that runs with\nthe workflow job's permissions.\n\nDo not run this action on untrusted code in privileged contexts such as\n`pull_request_target`. Prefer `pull_request` for untrusted contributions, limit\ntoken permissions, and avoid exposing sensitive secrets to jobs that invoke\nthis action.\n\nHere is an example demonstrating how to use it in a workflow with a matrix job:\n\n```yaml\njobs:\n  cross-arch-python:\n    name: Cross-arch tests with python\n    strategy:\n      fail-fast: false\n      matrix:\n        architecture:\n          - \"arm64\"\n        ubuntu_version:\n          - \"20.04\"\n        python_version:\n          - \"3.11\"\n\n    runs-on: ubuntu-${{ matrix.ubuntu_version }}\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n      - name: Test\n        uses: frequenz-floss/gh-action-run-python-in-qemu@v0.x.x\n        with:\n          architecture: ${{ matrix.architecture }}\n          script: \"scripts/pytest.sh\"\n          ubuntu_version: ${{ matrix.ubuntu_version }}\n          python_version: ${{ matrix.python_version }}\n```\n\nAnd `scripts/test.py` could be something like:\n\n```sh\n#!/bin/sh\n\npython -m pytest\n```\n\n## Inputs\n\n\u003e [!IMPORTANT]\n\u003e At least one of `ubuntu_version` or `dockerfile` inputs must be specified.\n\u003e\n\u003e When `dockerfile` is not set a `Dockerfile` is provided by the action. To\n\u003e test using other OSs you must provide your own `Dockerfile`. You can use the\n\u003e [Dockerfile in this action](resources/Dockerfile) (and optionally the\n\u003e [entry_point](resources/entrypoint)) as a starting point.\n\n* `architecture`: The architecture to use. Required.\n\n  It must be supported by [QEMU][qemu] and in particular the\n  [`docker/setup-qemu-action`](https://github.com/docker/setup-qemu-action)\n  action. For example: `arm64`.\n\n* `python_version`: The Python version to use. Required.\n\n  If `dockerfile` is not set, this version should be present as an Ubuntu\n  package in provided `ubuntu_version`. For example, `3.11`, `3.12`, etc. The\n  package `python{python_version}` will be installed and used.\n\n  If `dockerfile` is set, then the way to specify the Python version is\n  up to the `dockerfile`, but it should install the requested Python\n  version and set it as the default `python` and `python3` commands.\n\n* `script`: The script to run. Required.\n\n  This is the path to the script to run in the environment. It must be relative\n  to the root of the repository and have the executable bit set. For example:\n  `scripts/test.sh`.\n\n  Please note that:\n\n  * The script should not depend on where it is located or other files in\n    your repository, as it will be copied to the Docker container (inside\n    `/usr/local/bin`) and run there.\n  \n  * Only scripts are supported for now, this should be a file and exist in\n    the repository, you cannot run a command directly.\n\n* `pass_env`: The environment variables to pass to the script. Optional.\n\n  The format is `VAR1=VALUE1 VAR2=VALUE2 ...`. For example, `FOO=bar BAZ=qux`.\n\n  The environment variables will be set in the Docker container before running\n  the script.\n\n  Due to current limitations, values can't have spaces or other special\n  characters interpreted by bash.\n\n* `ubuntu_version`: The Ubuntu version to use. Required unless `dockerfile` is\n  set. Default: `\"\"`. For example, `20.04`, `22.04`, etc.\n\n  If `dockerfile` is not specified, a `Dockerfile` will be automatically\n  provided using `ubuntu:{ubuntu_version}` as the base [Docker][docker] image\n  where `script` will be run.\n\n* `dockerfile`: The Dockerfile to use. Optional unless `ubuntu_version` and\n  `python_version` are not set.\n\n  When this is used, the docker context directory will be set to the directory\n  containing the `dockerfile`. Default: `\"\"`.\n\n  You `Dockerfile` should accept 3 `ARG`s:\n\n  * `SCRIPT`: It will be the local path of the script, the `Dockerfile` should\n    copy it to `/usr/local/bin`, as the action will run it from there.\n\n  * `UBUNTU_VERSION`: The Ubuntu passed by the user, it can be empty, and it\n    can be ignored if your Docker image is not based in Ubuntu.\n\n  * `PYTHON_VERSION`: The Python version passed by the user, it can be empty.\n    If set the Docker image should provide that Python version when calling\n    `python` and `python3`.\n\n## Example using a custom `Dockerfile`\n\nFetching submodules recursively and using a custom `Dockerfile`:\n\n```yaml\njobs:\n  cross-arch-test:\n    name: Test in arm64\n    runs-on: ubuntu-20.04\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n      - name: Run test (arm64)\n        uses: frequenz-floss/gh-action-run-python-in-qemu@v0.x.x\n        with:\n          architecture: arm64\n          script: docker/test.sh\n          dockerfile: docker/Dockerfile.arm64\n```\n\n[qemu]: https://www.qemu.org/\n[docker]: https://www.docker.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrequenz-floss%2Fgh-action-run-python-in-qemu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrequenz-floss%2Fgh-action-run-python-in-qemu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrequenz-floss%2Fgh-action-run-python-in-qemu/lists"}