28. Migrating to Codeberg
I am moving the Mismiy project to Codeberg from GitHub. The reasons for wanting to reduce my dependence on GitHub is partially motivated by a desire to be less dependent on American-owned infrastructure generally. This is partly political and partly pragmatic.
Codeberg is a version control service for open-source projects from Germany. It is built with the open-source version control software Forgejo and run as a non-profit, community-led organization. They have a statement on Protecting our FLOSS commons from LLMs.
Migration
Setting up the account and copying the project GIt repository was straightforward enough. They have a migration that will handle GitHub-specific content like milestones and issues, but this project is so small it does not use them enough that migrating them seemed necessary.
Actions
Codeberg is an instance of Forgejo, which has a CI support in Forgejo actions designed
to be familiar to users of GitHub actions. The gist is the same—a YAML file
in a specially named directory with instructions for executing steps. One difference
is that Forgejo expects runners to be supplied externally. Users with ambitious
CI needs can supply their own. I expect Mismiy’s little needs will be easily met by the
codeberg-tiny runner.
The process of assembling an action is a bit hit & miss. The obvious way to start
is by creating the .forgejo/workflows/build_and_test.yaml but then the only
way to debug your CI steps is by checking in the file and pushing a commit, which
is a bit wasteful. Codeberg encourages a more mindful approach to the use of
computing resources. So I think I can make faster progress on debugging the
steps themselves by firing up Docker image locally. Looking at the Action output,
it seems the image name is ghcr.io/catthehacker/ubuntu:act-latest.
Here’s a way to do this:
brew install colima docker
colima start
docker run --rm -ti --mount type=bind,src=.,dst=/d,ro -w/d ghcr.io/catthehacker/ubuntu:act-latest
Now we can rehearse the process of installing Poetry and testing the app.
export PATH=$(pipx environment --value PIPX_BIN_DIR):$PATH
pipx install poetry
poetry install
poetry run python -munittest
Translating this in to a workflow file is relatively straightforward, though I did got caught out by the way in which each step runs in its own container, which means effects of commands, other than changes to files, vanish between steps. Thus we only need to install [Poetry] once, but must start each step that uses it with a command to update the environment:
export PATH=$(pipx environment --value PIPX_BIN_DIR):$PATH
Codeberg supports another CI system Woodpecker. Skimming the documentation it looks roughly similar in approach: there are YAML files containing workflows that run scripts in Docker containers. The main difference is perhaps that Woodpecker is an outside project, whereas Forgejo Actions are part of the Forgejo project that Codeberg is an instance of.
Posts on similar topics