Add setup build environment action
build / linux (push) Failing after 0s

This commit is contained in:
2026-05-02 17:52:25 +03:00
parent 349fc5675f
commit 62cfb45fe1
3 changed files with 267 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
# setup-build-env Gitea Action
Reusable Gitea/GitHub-compatible composite action for Debian/Ubuntu runners. It installs:
- Clang/LLVM, default `22`
- Meson, installed in an isolated Python virtual environment to avoid PEP 668 `externally-managed-environment` errors
- Ninja
- Python 3, pip, venv
- Vulkan development tooling / SDK packages
## Local use inside a repository
Put this directory at:
```text
.gitea/actions/setup-build-env
```
Then use it from a workflow:
```yaml
name: build
on:
push:
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
container:
image: debian:trixie
steps:
- uses: actions/checkout@v4
- uses: ./.gitea/actions/setup-build-env
with:
llvm-version: "22"
vulkan-source: apt
- run: |
meson setup build --native-file build_options/meson-clang-linux
meson compile -C build
```
## Use from a shared action repository
Create a dedicated repository, for example:
```text
gitea.example.com/actions/setup-build-env
```
Put `action.yml`, `scripts/setup.sh`, and this README at the root of that repository. Then tag it:
```bash
git tag v1
git push origin v1
```
Use it from all projects:
```yaml
- uses: actions/setup-build-env@v1
```
or with your full Gitea owner/repo path, depending on your Gitea Actions configuration:
```yaml
- uses: your-org/setup-build-env@v1
```
## Inputs
| Input | Default | Description |
| --- | --- | --- |
| `llvm-version` | `22` | LLVM/Clang major version. Installs packages like `clang-22`, `lld-22`, `llvm-22-dev`. |
| `meson-version` | `latest` | Meson version installed into `/opt/meson-venv`. Use e.g. `1.6.1` to pin. |
| `install-vulkan` | `true` | Install Vulkan packages. |
| `vulkan-source` | `apt` | `apt` for distro packages, or `lunarg` for the LunarG apt repository. |
| `lunarg-sdk-version` | `1.4.309.0` | LunarG SDK version used when `vulkan-source: lunarg`. |
| `make-default` | `true` | Makes `clang`, `clang++`, `lld`, etc point at the selected LLVM version through `update-alternatives`. |
## Notes
- This action assumes an apt-based Debian/Ubuntu runner/container.
- If your runner is not root, it needs passwordless `sudo`.
- `vulkan-source: apt` is recommended for CI because it is the most robust across Debian/Ubuntu images.
- `vulkan-source: lunarg` is best used on Ubuntu images supported by LunarG.
- Because this installs system packages, caching the entire result is normally done at the runner/container-image level. For faster builds, consider creating your own Docker image from the commands in `scripts/setup.sh`.