Skip to content

Commit ce29a49

Browse files
committed
add support for Forgejo Actions
1 parent 15dd43b commit ce29a49

File tree

3 files changed

+73
-2
lines changed

3 files changed

+73
-2
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on: workflow_dispatch
2+
3+
jobs:
4+
runner-select:
5+
runs-on: codeberg-tiny
6+
outputs:
7+
unique-id: ${{ steps.select.outputs.unique-id }}
8+
selected-runner-label: ${{ steps.select.outputs.selected-runner-label }}
9+
runner-type-label: ${{ steps.select.outputs.runner-type-label }}
10+
is-self-hosted: ${{ steps.select.outputs.is-self-hosted }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Runner select
14+
id: select
15+
uses: ./actions/runner-select
16+
with:
17+
forge-is-forgejo: true
18+
queue-api-base-url: http://home.daz.cat:8002
19+
GITHUB_TOKEN: ${{ github.token }}
20+
# Before updating the GH action runner image for the nightly job, ensure
21+
# that the system has a glibc version that is compatible with the one
22+
# used by the wpt.fyi runners.
23+
github-hosted-runner-label: codeberg-tiny
24+
self-hosted-image-name: base-ubuntu2204
25+
# You can disable self-hosted runners globally by creating a repository variable named
26+
# NO_SELF_HOSTED_RUNNERS with any non-empty value.
27+
# <https://github.com/servo/servo/settings/variables/actions>
28+
NO_SELF_HOSTED_RUNNERS: ${{ vars.NO_SELF_HOSTED_RUNNERS }}
29+
# Any other boolean conditions that disable self-hosted runners go here.
30+
force-github-hosted-runner: ${{ inputs.upload || inputs.force-github-hosted-runner }}
31+
runner-timeout:
32+
needs:
33+
- runner-select
34+
if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
35+
runs-on: codeberg-tiny
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Runner timeout
39+
uses: ./actions/runner-timeout
40+
with:
41+
github_token: '${{ secrets.GITHUB_TOKEN }}'
42+
unique-id: '${{ needs.runner-select.outputs.unique-id }}'
43+
44+
build:
45+
needs:
46+
- runner-select
47+
name: build [${{ needs.runner-select.outputs.unique-id }}]
48+
runs-on: ${{ needs.runner-select.outputs.selected-runner-label }}
49+
steps:
50+
- uses: actions/checkout@v4

.github/workflows/self-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
id: select
1515
uses: ./actions/runner-select
1616
with:
17+
forge-is-forgejo: false
18+
queue-api-base-url: https://ci0.servo.org/queue
1719
GITHUB_TOKEN: ${{ github.token }}
1820
# Before updating the GH action runner image for the nightly job, ensure
1921
# that the system has a glibc version that is compatible with the one

actions/runner-select/action.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Select Self-hosted Runner
22
inputs:
3+
forge-is-forgejo:
4+
required: true
5+
type: boolean
6+
queue-api-base-url:
7+
required: true
8+
type: string
39
GITHUB_TOKEN:
410
required: true
511
type: string
@@ -41,6 +47,19 @@ runs:
4147
4248
set -euo pipefail
4349
50+
apt_install() {
51+
# Install distro packages, but only if one or more are not already installed.
52+
# Update the package lists first, to avoid failures when rebaking old images.
53+
if ! dpkg -s "$@" > /dev/null 2>&1; then
54+
apt update
55+
# DEBIAN_FRONTEND needed to avoid hang when installing tshark
56+
DEBIAN_FRONTEND=noninteractive apt install -y "$@"
57+
fi
58+
}
59+
60+
# Already installed on GitHub ubuntu-24.04, but not Codeberg codeberg-tiny.
61+
apt_install uuid-runtime
62+
4463
# Generate a unique id that allows the workload job to find the runner
4564
# we are reserving for it (via runner labels), and allows the timeout
4665
# job to find the workload job run (via the job’s friendly name), even
@@ -78,7 +97,7 @@ runs:
7897
- id: artifact
7998
name: Publish artifact with args
8099
if: ${{ !fromJSON(steps.init.outputs.disabled) }}
81-
uses: actions/upload-artifact@v4
100+
uses: ${{ inputs.forge-is-forgejo && 'forgejo/upload-artifact@v4' || 'actions/upload-artifact@v4' }}
82101
with:
83102
name: servo-ci-runners_${{ steps.init.outputs.unique_id }}
84103
path: ${{ steps.init.outputs.artifact_path }}
@@ -88,6 +107,7 @@ runs:
88107
name: Find a server and reserve a runner
89108
shell: bash
90109
run: |
110+
queue_api_base_url='${{ inputs.queue-api-base-url }}'
91111
github_hosted_runner_label='${{ inputs.github-hosted-runner-label }}'
92112
self_hosted_image_name='${{ inputs.self-hosted-image-name }}'
93113
disabled='${{ steps.init.outputs.disabled }}'
@@ -107,7 +127,6 @@ runs:
107127
fall_back_to_github_hosted
108128
fi
109129
110-
queue_api_base_url=https://ci0.servo.org/queue
111130
# Use the queue API to enqueue this job.
112131
enqueue_url=$queue_api_base_url/enqueue\?unique_id=$unique_id\&qualified_repo=${{ github.repository }}\&run_id=${{ github.run_id }}
113132
result=$(mktemp)

0 commit comments

Comments
 (0)