Split env preparation boilerplate

This commit is contained in:
Otto Richter 2024-09-27 20:44:22 +02:00
parent 89742c4913
commit 5b84756137
2 changed files with 18 additions and 44 deletions

View file

@ -0,0 +1,11 @@
runs:
using: "composite"
steps:
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: setup user and permissions
run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .

View file

@ -20,9 +20,7 @@ jobs:
${{ toJSON(github) }} ${{ toJSON(github) }}
EOF EOF
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
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: | - run: |
@ -67,13 +65,7 @@ jobs:
MINIO_ROOT_PASSWORD: 12345678 MINIO_ROOT_PASSWORD: 12345678
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- name: install git >= 2.42 - name: install git >= 2.42
run: | run: |
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -132,13 +124,7 @@ jobs:
options: ${{ matrix.cacher.options }} options: ${{ matrix.cacher.options }}
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- name: install git >= 2.42 - name: install git >= 2.42
run: | run: |
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -184,9 +170,7 @@ jobs:
MYSQL_EXTRA_FLAGS: --innodb-adaptive-flushing=OFF --innodb-buffer-pool-size=4G --innodb-log-buffer-size=128M --innodb-flush-log-at-trx-commit=0 --innodb-flush-log-at-timeout=30 --innodb-flush-method=nosync --innodb-fsync-threshold=1000000000 MYSQL_EXTRA_FLAGS: --innodb-adaptive-flushing=OFF --innodb-buffer-pool-size=4G --innodb-log-buffer-size=128M --innodb-flush-log-at-trx-commit=0 --innodb-flush-log-at-timeout=30 --innodb-flush-method=nosync --innodb-fsync-threshold=1000000000
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- name: install dependencies & git >= 2.42 - name: install dependencies & git >= 2.42
run: | run: |
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -195,11 +179,6 @@ jobs:
apt-get install --no-install-recommends -qq -y git git-lfs apt-get install --no-install-recommends -qq -y git git-lfs
rm /etc/apt/sources.list.d/testing.list rm /etc/apt/sources.list.d/testing.list
apt-get update -qq apt-get update -qq
- name: setup user and permissions
run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- uses: actions/cache/restore@v4 - uses: actions/cache/restore@v4
@ -238,9 +217,7 @@ jobs:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- name: install dependencies & git >= 2.42 - name: install dependencies & git >= 2.42
run: | run: |
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -249,11 +226,6 @@ jobs:
apt-get install --no-install-recommends -qq -y git git-lfs apt-get install --no-install-recommends -qq -y git git-lfs
rm /etc/apt/sources.list.d/testing.list rm /etc/apt/sources.list.d/testing.list
apt-get update -qq apt-get update -qq
- name: setup user and permissions
run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- uses: actions/cache/restore@v4 - uses: actions/cache/restore@v4
@ -281,9 +253,7 @@ jobs:
image: 'code.forgejo.org/oci/node:20-bookworm' image: 'code.forgejo.org/oci/node:20-bookworm'
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- name: install dependencies & git >= 2.42 - name: install dependencies & git >= 2.42
run: | run: |
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -292,11 +262,6 @@ jobs:
apt-get install --no-install-recommends -qq -y git git-lfs apt-get install --no-install-recommends -qq -y git git-lfs
rm /etc/apt/sources.list.d/testing.list rm /etc/apt/sources.list.d/testing.list
apt-get update -qq apt-get update -qq
- name: setup user and permissions
run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- run: | - run: |
su forgejo -c 'make deps-backend' su forgejo -c 'make deps-backend'
- uses: actions/cache/restore@v4 - uses: actions/cache/restore@v4
@ -330,8 +295,6 @@ jobs:
image: 'code.forgejo.org/oci/node:20-bookworm' image: 'code.forgejo.org/oci/node:20-bookworm'
steps: steps:
- uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4 - uses: ./.forgejo/workflows/composite/setup-env
with:
go-version-file: "go.mod"
- run: make deps-backend deps-tools - run: make deps-backend deps-tools
- run: make security-check - run: make security-check