# Zig CI Setup on Codeberg

**URL:** <https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239>\
**Category:** Help\
**Tags:** ci\
**Created:** [November 27, 2025, 5:16am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239 "2025-11-27T05:16:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [November 27, 2025, 5:16am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/1 "2025-11-27T05:16:02Z")

</div>

Does anyone have an example of using community mirrors properly with codeberg CI?

I imagine I would use something like an alpine container that downloads zig. Not sure yet though.

---

<div class="post-metadata">

**Author:** ![mlugg](https://ziggit.dev/user_avatar/ziggit.dev/mlugg/32/437_2.png) [@mlugg](https://ziggit.dev/u/mlugg)\
**Post date:** [November 27, 2025, 5:28am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/2 "2025-11-27T05:28:34Z")

</div>

I’m not sure if anything exists for Woodpecker, but FWIW, Codeberg supports Forgejo Actions, which has sufficient compatibility with GitHub Actions that [setup-zig](https://codeberg.org/mlugg/setup-zig) pretty much just works.

---

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [November 27, 2025, 5:35am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/3 "2025-11-27T05:35:43Z")

</div>

The docs do explicitly state that they prefer woodpecker, at least for now.

> **[Using Forgejo Actions (Self-hosted) | Codeberg Documentation](https://docs.codeberg.org/ci/actions/)**

“Due to outstanding security issues and bus factor (we need more maintainers for our CI service), we are currently providing hosted Actions in limited fashion: see [actions/meta: Information and discussions around hosted Forgejo Actions at Codeberg - Codeberg.org](https://codeberg.org/actions/meta). If you need Codeberg to host your CI, please use Woodpecker CI instead.”

---

<div class="post-metadata">

**Author:** ![tensorush](https://ziggit.dev/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tensorush](https://ziggit.dev/u/tensorush)\
**Post date:** [November 27, 2025, 6:21am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/4 "2025-11-27T06:21:41Z")

</div>

[Liza](https://ziggit.dev/t/liza-zig-codebase-initializer/3486) provides [Woodpecker CI](https://codeberg.org/tensorush/liza/src/branch/main/src/templates/.woodpecker) and [Forgejo Actions](https://codeberg.org/tensorush/liza/src/branch/main/src/templates/.forgejo/workflows) setups. Woodpecker CI often requires manual steps, like generating Access Tokens and granting permissions, see README for details:

> **[liza](https://codeberg.org/tensorush/liza#github-src-templates-github-workflows-ci-yaml-forgejo-src-templates-forgejo-workflows-ci-yaml-woodpecker-src-templates-woodpecker-ci-yaml-ci-workflow-template-jobs)**
>
> Zig codebase initializer.

---

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [April 24, 2026, 4:36am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/5 "2026-04-24T04:36:51Z")

</div>

came back to this recently, hoping to come up with a setup that doesn’t rely on someone else’s docker image build

---

<div class="post-metadata">

**Author:** ![alexrp](https://ziggit.dev/user_avatar/ziggit.dev/alexrp/32/2793_2.png) [@alexrp](https://ziggit.dev/u/alexrp)\
**Post date:** [April 24, 2026, 6:30am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/6 "2026-04-24T06:30:28Z")

</div>

A bit late to the party here, but I think it’s safe to say that Forgejo Actions is the preferred CI solution now. It has many active maintainers and we’ve been using it quite successfully for Zig since we migrated to Codeberg. This page probably needs an update.

---

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [April 24, 2026, 6:53am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/7 "2026-04-24T06:53:42Z")

</div>

well shucks what am I supposed to do with this kickass downloader script i just wrote! 🙂

```sh
set -ex

# change this to upgrade zig
tarball_name='zig-x86_64-linux-0.16.0.tar.xz'

# tells mirror who is downloading for stats
source='jeffs_bash_script'
# pubkey obtained from https://ziglang.org/download
pubkey='RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'

# ASCII-encoded, one mirror per line, newlines are LF, there is a trailing newline.
mirrors=$(curl --fail https://ziglang.org/download/community-mirrors.txt)

success=0
set +e
for i in {1..5}; do
    {
        mirror_url=$(echo "$mirrors" | shuf -n 1)
        tarball_url="${mirror_url}/${tarball_name}?source=${source}"
        signature_url="${mirror_url}/${tarball_name}.minisig?source=${source}"
        curl --fail -o "${tarball_name}.minisig" "$signature_url"
        curl --fail -o "$tarball_name" "$tarball_url"
        minisign -V -P "$pubkey" -m "$tarball_name"
        success=1
        break
    } || continue;
done
set -e

if [$success -eq 0]; then
    echo "failed to download zig"
    exit 1
fi

mkdir zig
tar --strip-components 1 -xf "$tarball_name" -C zig
chmod +x zig/zig
zig/zig version
echo "success: zig accessible at zig/zig"

```

---

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [April 24, 2026, 7:24am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/8 "2026-04-24T07:24:23Z")

</div>

I’m bookmarking it! I prefer Woodpecker to Actions, so I’ll put it to good use at some point. Thanks for sharing 😉

---

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [April 24, 2026, 9:40am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/9 "2026-04-24T09:40:53Z")

</div>

> [@jeffective](#):
>
> ```zig
> # ASCII-encoded, one mirror per line, newlines are LF, there is a trailing newline.
> mirrors=$(curl --fail https://ziglang.org/download/community-mirrors.txt)
> 
> ```

By the way, you should probably have the mirrors checked in somewhere in a repo instead of pulling them from `ziglang.org` every time, because like this, if `ziglang.org` is down, you have no mirrors, kinda defeating the purpose 🙂

---

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [April 28, 2026, 8:05am UTC](https://ziggit.dev/t/zig-ci-setup-on-codeberg/13239/10 "2026-04-28T08:05:10Z")

</div>

heres what I came up with, it runs a `zig build ci` step in an alpine container, downloading zig using the mirrors, curl, minisign, and /bin/sh

and @spiffyk I fixed it to have a list of fallback mirrors if [ziglang.org](http://ziglang.org) is down like you suggested, thanks!

`.woodpecker/ci.yaml`

```yaml
when:
  - event: pull_request
  - event: push
    branch: main

steps:
  - name: build
    image: alpine
    entrypoint: ["/bin/sh", "-c", "./.woodpecker/ci.sh"]

```

`.woodpecker/ci.sh`

```sh
# intended to be run inside an alpine container 
# downloads zig to ./zig/zig using community mirrors, verifies signature
set -ex

# change this to upgrade zig
tarball_name='zig-x86_64-linux-0.16.0.tar.xz'

# curl for downloading zig
# minisign for signature verification
apk add curl minisign

# tells mirror who is downloading for stats
source='jeffs_bash_script'
# pubkey obtained from https://ziglang.org/download
pubkey='RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'

# ASCII-encoded, one mirror per line, newlines are LF, there is a trailing newline.
fallback_mirrors='https://pkg.hexops.org/zig
https://zigmirror.hryx.net/zig
https://zig.linus.dev/zig
https://zig.squirl.dev
https://zig.mirror.mschae23.de/zig
https://ziglang.freetls.fastly.net
https://zig.tilok.dev
https://zig-mirror.tsimnet.eu/zig
https://zig.karearl.com/zig
https://pkg.earth/zig
https://fs.liujiacai.net/zigbuilds
https://zigmirror.com
https://zig.chainsafe.dev
https://zig.savalione.com
'

set +e
mirrors=$(curl --fail https://ziglang.org/download/community-mirrors.txt) || mirrors="$fallback_mirrors"
set -e

success=0
set +e
for i in 1 2 3 4 5; do
    mirror_url=$(echo "$mirrors" | shuf -n 1)
    tarball_url="${mirror_url}/${tarball_name}?source=${source}"
    signature_url="${mirror_url}/${tarball_name}.minisig?source=${source}"

    if 
        curl --fail -o "${tarball_name}.minisig" "$signature_url" &&
        curl --fail -o "$tarball_name" "$tarball_url" &&
        minisign -V -P "$pubkey" -m "$tarball_name";
    then
        success=1
        break
    fi
done
set -e

if [$success -eq 0]; then
    echo "failed to download zig"
    exit 1
fi

mkdir zig
tar --strip-components 1 -xf "$tarball_name" -C zig
chmod +x zig/zig
zig/zig version
echo "success! zig accessible at zig/zig"
zig/zig build ci --summary all

```

> **example ci output**
>
> ```zig
> + tarball_name=zig-x86_64-linux-0.16.0.tar.xz
> + apk add curl minisign
> ( 1/12) Installing brotli-libs (1.2.0-r0)
> ( 2/12) Installing c-ares (1.34.6-r0)
> ( 3/12) Installing libunistring (1.4.1-r0)
> ( 4/12) Installing libidn2 (2.3.8-r0)
> ( 5/12) Installing nghttp2-libs (1.68.0-r0)
> ( 6/12) Installing nghttp3 (1.13.1-r0)
> ( 7/12) Installing libpsl (0.21.5-r3)
> ( 8/12) Installing zstd-libs (1.5.7-r2)
> ( 9/12) Installing libcurl (8.17.0-r1)
> (10/12) Installing curl (8.17.0-r1)
> (11/12) Installing libsodium (1.0.20-r1)
> (12/12) Installing minisign (0.12-r1)
> Executing busybox-1.37.0-r30.trigger
> OK: 13.6 MiB in 28 packages
> + source=jeffs_bash_script
> + pubkey=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
> + fallback_mirrors='https://pkg.hexops.org/zig
> https://zigmirror.hryx.net/zig
> https://zig.linus.dev/zig
> https://zig.squirl.dev
> https://zig.mirror.mschae23.de/zig
> https://ziglang.freetls.fastly.net
> https://zig.tilok.dev
> https://zig-mirror.tsimnet.eu/zig
> https://zig.karearl.com/zig
> https://pkg.earth/zig
> https://fs.liujiacai.net/zigbuilds
> https://zigmirror.com
> https://zig.chainsafe.dev
> https://zig.savalione.com
> '
> + set +e
> + curl --fail https://ziglang.org/download/community-mirrors.txt
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
> 100 392 100 392 0 0 1137 0 --:--:-- --:--:-- --:--:-- 1142
> + mirrors='https://pkg.hexops.org/zig
> https://zigmirror.hryx.net/zig
> https://zig.linus.dev/zig
> https://zig.squirl.dev
> https://zig.mirror.mschae23.de/zig
> https://ziglang.freetls.fastly.net
> https://zig.tilok.dev
> https://zig-mirror.tsimnet.eu/zig
> https://zig.karearl.com/zig
> https://pkg.earth/zig
> https://fs.liujiacai.net/zigbuilds
> https://zigmirror.com
> https://zig.chainsafe.dev
> https://zig.savalione.com'
> + set -e
> + success=0
> + set +e
> + echo 'https://pkg.hexops.org/zig
> https://zigmirror.hryx.net/zig
> https://zig.linus.dev/zig
> https://zig.squirl.dev
> https://zig.mirror.mschae23.de/zig
> https://ziglang.freetls.fastly.net
> https://zig.tilok.dev
> https://zig-mirror.tsimnet.eu/zig
> https://zig.karearl.com/zig
> https://pkg.earth/zig
> https://fs.liujiacai.net/zigbuilds
> https://zigmirror.com
> https://zig.chainsafe.dev
> https://zig.savalione.com'
> + shuf -n 1
> + mirror_url=https://zig.chainsafe.dev
> + tarball_url='https://zig.chainsafe.dev/zig-x86_64-linux-0.16.0.tar.xz?source=jeffs_bash_script'
> + signature_url='https://zig.chainsafe.dev/zig-x86_64-linux-0.16.0.tar.xz.minisig?source=jeffs_bash_script'
> + curl --fail -o zig-x86_64-linux-0.16.0.tar.xz.minisig 'https://zig.chainsafe.dev/zig-x86_64-linux-0.16.0.tar.xz.minisig?source=jeffs_bash_script'
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
> 100 325 100 325 0 0 2084 0 --:--:-- --:--:-- --:--:-- 2110
> + curl --fail -o zig-x86_64-linux-0.16.0.tar.xz 'https://zig.chainsafe.dev/zig-x86_64-linux-0.16.0.tar.xz?source=jeffs_bash_script'
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
> 48 54178k 48 26498k 0 0 87996k 0 --:--:-- --:--:-- --:--:-- 88034k
> 100 54178k 100 54178k 0 0 76449k 0 --:--:-- --:--:-- --:--:-- 76522k
> + minisign -V -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U -m zig-x86_64-linux-0.16.0.tar.xz
> Signature and comment signature verified
> Trusted comment: timestamp:1776173777	file:zig-x86_64-linux-0.16.0.tar.xz	hashed
> + success=1
> + break
> + set -e
> + '[' 1 -eq 0]
> + mkdir zig
> + tar --strip-components 1 -xf zig-x86_64-linux-0.16.0.tar.xz -C zig
> + chmod +x zig/zig
> + zig/zig version
> 0.16.0
> success! zig accessible at zig/zig
> + echo 'success! zig accessible at zig/zig'
> + zig/zig build ci --summary all
> Build Summary: 27/27 steps succeeded; 6/6 tests passed
> ci success
> +- test success
> | +- run test 6 pass (6 total) 17ms MaxRSS:6M
> | | +- compile test Debug native success 663ms MaxRSS:167M
> | +- install hello_world success
> | +- compile exe hello_world Debug native success 575ms MaxRSS:155M
> +- install-tool success
> | +- install oci_builder success
> | +- compile exe oci_builder Debug native success 2s MaxRSS:256M
> +- create-index success
> | +- install generated to index.json success
> | | +- create-index success 16ms
> | | +- compile exe oci_builder Debug native (reused)
> | | +- create-manifest success 31ms
> | | | +- compile exe oci_builder Debug native (reused)
> | | | +- create-layer success 34ms
> | | | | +- compile exe oci_builder Debug native (reused)
> | | | +- create-layer (+1 more reused dependencies)
> | | | +- create-layer (+1 more reused dependencies)
> | | | +- create-layer success 10s
> | | | | +- compile exe oci_builder Debug native (reused)
> | | | | +- compile exe hello_world Debug native (reused)
> | | | | +- compile exe hello_world Debug native (reused)
> | | | +- create-layer (+3 more reused dependencies)
> | | | +- create-layer (+3 more reused dependencies)
> | | | +- create-layer success 32ms
> | | | | +- compile exe oci_builder Debug native (reused)
> | | | +- create-layer (+1 more reused dependencies)
> | | | +- create-layer (+1 more reused dependencies)
> | | +- create-manifest (+10 more reused dependencies)
> | +- install generated to layout.tar.gz success
> | +- create-layout success 41ms
> | +- compile exe oci_builder Debug native (reused)
> | +- create-index (+3 more reused dependencies)
> | +- create-index (+3 more reused dependencies)
> | +- create-manifest (+10 more reused dependencies)
> | +- create-manifest (+10 more reused dependencies)
> | +- create-manifest (+10 more reused dependencies)
> | +- create-manifest (+10 more reused dependencies)
> | +- create-layer (+1 more reused dependencies)
> | +- create-layer (+1 more reused dependencies)
> | +- create-layer (+3 more reused dependencies)
> | +- create-layer (+3 more reused dependencies)
> | +- create-layer (+1 more reused dependencies)
> | +- create-layer (+1 more reused dependencies)
> +- create-manifest success
> | +- install generated to manifest.json success
> | | +- create-manifest (+10 more reused dependencies)
> | +- install generated to manifest_descriptor.json success
> | | +- create-manifest (+10 more reused dependencies)
> | +- install generated to config.json success
> | | +- create-manifest (+10 more reused dependencies)
> | +- install generated to config_descriptor.json success
> | +- create-manifest (+10 more reused dependencies)
> +- create-layer success
> | +- install generated to layer_2.tar.gz success
> | +- create-layer (+3 more reused dependencies)
> +- oci-dir success
> +- install generated/ success
> +- create-layout (+13 more reused dependencies)
> 
> ```

from repo: [https://codeberg.org/jeffective/oci](https://codeberg.org/jeffective/oci)
