Skip to content

Commit c892ab0

Browse files
Speed up nightly builds (#27045)
* Rootless/ful docker images build separately * Vendor go modules outside docker to speed up the build Thanks to Alex Ellis for these suggestions (and actuated runner build time)
1 parent 739e47c commit c892ab0

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/actionlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
self-hosted-runner:
2+
labels:
3+
- actuated-4cpu-8gb
4+
- actuated-4cpu-16gb

.github/workflows/release-nightly.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
branches: [ main, release/v* ]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
711
jobs:
812
nightly-binary:
913
runs-on: actuated-4cpu-8gb
@@ -51,7 +55,7 @@ jobs:
5155
AWS_REGION: ${{ secrets.AWS_REGION }}
5256
SOURCE_DIR: dist/release
5357
DEST_DIR: gitea/${{ steps.clean_name.outputs.branch }}
54-
nightly-docker:
58+
nightly-docker-rootful:
5559
runs-on: actuated-4cpu-8gb
5660
steps:
5761
- uses: actions/checkout@v3
@@ -75,13 +79,41 @@ jobs:
7579
with:
7680
username: ${{ secrets.DOCKERHUB_USERNAME }}
7781
password: ${{ secrets.DOCKERHUB_TOKEN }}
82+
- name: fetch go modules
83+
run: make vendor
7884
- name: build rootful docker image
7985
uses: docker/build-push-action@v4
8086
with:
8187
context: .
8288
platforms: linux/amd64,linux/arm64
8389
push: true
8490
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
91+
nightly-docker-rootless:
92+
runs-on: actuated-4cpu-8gb
93+
steps:
94+
- uses: actions/checkout@v3
95+
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
96+
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
97+
- run: git fetch --unshallow --quiet --tags --force
98+
- uses: docker/setup-qemu-action@v2
99+
- uses: docker/setup-buildx-action@v2
100+
- name: Get cleaned branch name
101+
id: clean_name
102+
run: |
103+
# if main then say nightly otherwise cleanup name
104+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
105+
echo "branch=nightly" >> "$GITHUB_OUTPUT"
106+
exit 0
107+
fi
108+
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
109+
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
110+
- name: Login to Docker Hub
111+
uses: docker/login-action@v2
112+
with:
113+
username: ${{ secrets.DOCKERHUB_USERNAME }}
114+
password: ${{ secrets.DOCKERHUB_TOKEN }}
115+
- name: fetch go modules
116+
run: make vendor
85117
- name: build rootless docker image
86118
uses: docker/build-push-action@v4
87119
with:

0 commit comments

Comments
 (0)