Forgejo Runnerでsetup-pythonを動かした手順メモ
このエントリでは、
Forgejo Runnerでsetup-pythonを動かしたメモを残しておきます。
Forgejo/Runner自体のセットアップ関連は、過去のエントリを参照ください。
UbuntuLinuxにForgejoをセットアップする手順
https://takemikami.com/2024/03/18/UbuntuLinuxForgejo.html
Workflowの変更
GitHub Actionsで、
setup-pythonを動かす場合は次のようにWorkflowを記載します。
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python --version
Forgejoの場合、uses
で指定したactionsは、code.forgejo.org
のリポジトリをさすので、
GitHubを参照するよう、以下の通り変更します。
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/setup-python@v5
with:
python-version: '3.11'
- run: python --version
Nodejsのインストール
Forgejo Runnerからactionsを動かすためにNodejsが必要なため、
インストールしておきます。
Utunbu22標準の状態でaptからインストールされる12系のNodejsでは、
setup-pythonが動かないようなので、
以下のサイトなどを参照して、20.x系のNodejsをインストールします。
Welcome to Node.js DEB repository
https://deb.nodesource.com/
OSの情報が取得できない問題の対処
ここまでの準備を行った状態でActionを動かしたところ、以下のようなエラーが発生しました。
::error::The version '3.11' with architecture 'x64' was not found for this operating system.%0AThe list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
setup-pythonのコードを読んで確認したところ、
OSの情報が取得できていないことが原因ようです。
そこでlsb_release
を実行すると、以下のようになっています。
$ lsb_release
No LSB modules are available.
lsb_release
でOSの情報が取得できるよう、lsb-coreをインストールします。
sudo apt install lsb-core
インストール後、再度lsb_release
を実行してOSの情報が取得できることを確認します。
$ lsb_release -i -r -s
Ubuntu
22.04
この状態で、Actionを再実行するとPythonがセットアップできます。
以上。