Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

Merge pull request 'chore(ci): Cache generated binary across jobs' (#5130) from fnetx/runner-caching into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5130
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-08-30 05:47:01 +00:00
commit 293203cb64
2 changed files with 46 additions and 10 deletions

View file

@ -25,6 +25,14 @@ jobs:
go-version-file: "go.mod" go-version-file: "go.mod"
- run: make deps-backend deps-tools - run: make deps-backend deps-tools
- run: make --always-make -j$(nproc) lint-backend tidy-check swagger-check fmt-check swagger-validate # ensure the "go-licenses" make target runs - run: make --always-make -j$(nproc) lint-backend tidy-check swagger-check fmt-check swagger-validate # ensure the "go-licenses" make target runs
- run: |
make backend
env:
TAGS: bindata
- uses: actions/cache@v4
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
frontend-checks: frontend-checks:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }} if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
runs-on: docker runs-on: docker
@ -80,7 +88,13 @@ jobs:
./release-notes-assistant.sh test_main ./release-notes-assistant.sh test_main
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- run: | - uses: actions/cache/restore@v4
id: cache-backend
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
- if: steps.cache-backend.outputs.cache-hit != 'true'
run: |
su forgejo -c 'make backend' su forgejo -c 'make backend'
env: env:
TAGS: bindata TAGS: bindata
@ -135,7 +149,13 @@ jobs:
apt-get update -qq apt-get update -qq
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- run: | - uses: actions/cache/restore@v4
id: cache-backend
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
- if: steps.cache-backend.outputs.cache-hit != 'true'
run: |
su forgejo -c 'make backend' su forgejo -c 'make backend'
env: env:
TAGS: bindata TAGS: bindata
@ -182,7 +202,13 @@ jobs:
chown -R forgejo:forgejo . chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- run: | - uses: actions/cache/restore@v4
id: cache-backend
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
- if: steps.cache-backend.outputs.cache-hit != 'true'
run: |
su forgejo -c 'make backend' su forgejo -c 'make backend'
env: env:
TAGS: bindata TAGS: bindata
@ -190,7 +216,6 @@ jobs:
su forgejo -c 'make test-mysql-migration test-mysql' su forgejo -c 'make test-mysql-migration test-mysql'
timeout-minutes: 50 timeout-minutes: 50
env: env:
TAGS: bindata
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
test-pgsql: test-pgsql:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }} if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
@ -231,7 +256,13 @@ jobs:
chown -R forgejo:forgejo . chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- run: | - uses: actions/cache/restore@v4
id: cache-backend
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
- if: steps.cache-backend.outputs.cache-hit != 'true'
run: |
su forgejo -c 'make backend' su forgejo -c 'make backend'
env: env:
TAGS: bindata TAGS: bindata
@ -239,7 +270,6 @@ jobs:
su forgejo -c 'make test-pgsql-migration test-pgsql' su forgejo -c 'make test-pgsql-migration test-pgsql'
timeout-minutes: 50 timeout-minutes: 50
env: env:
TAGS: bindata
RACE_ENABLED: true RACE_ENABLED: true
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
TEST_LDAP: 1 TEST_LDAP: 1
@ -269,7 +299,13 @@ jobs:
chown -R forgejo:forgejo . chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- run: | - uses: actions/cache/restore@v4
id: cache-backend
with:
path: '/workspace/forgejo/forgejo/gitea'
key: backend-build-${{ github.sha }}
- if: steps.cache-backend.outputs.cache-hit != 'true'
run: |
su forgejo -c 'make backend' su forgejo -c 'make backend'
env: env:
TAGS: bindata sqlite sqlite_unlock_notify TAGS: bindata sqlite sqlite_unlock_notify
@ -277,7 +313,7 @@ jobs:
su forgejo -c 'make test-sqlite-migration test-sqlite' su forgejo -c 'make test-sqlite-migration test-sqlite'
timeout-minutes: 50 timeout-minutes: 50
env: env:
TAGS: bindata sqlite sqlite_unlock_notify TAGS: sqlite sqlite_unlock_notify
RACE_ENABLED: true RACE_ENABLED: true
TEST_TAGS: sqlite sqlite_unlock_notify TEST_TAGS: sqlite sqlite_unlock_notify
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1

View file

@ -16,7 +16,7 @@ import (
) )
func TestWriterReader(t *testing.T) { func TestWriterReader(t *testing.T) {
testData := prepareTestData(t, 20_000_000) testData := prepareTestData(t, 15_000_000)
result := bytes.NewBuffer(nil) result := bytes.NewBuffer(nil)
@ -64,7 +64,7 @@ func TestWriterReader(t *testing.T) {
} }
func TestSeekableWriterReader(t *testing.T) { func TestSeekableWriterReader(t *testing.T) {
testData := prepareTestData(t, 20_000_000) testData := prepareTestData(t, 15_000_000)
result := bytes.NewBuffer(nil) result := bytes.NewBuffer(nil)