Incorporates these changes: - When `forgejo/build-from-sources` is present, Actions & Packages tests are run only against the built versions. Otherwise, they are run against the versions defined in `$RELEASE_NUMBERS` - Updates Packages tests which are testing Alpine publishing to use currently supported Alpine releases - Actions & Packages tests are run in a matrix, allowing parallel execution Only the Actions & Packages tests take a significant amount of time (>10 minutes), so changes have been limited to those test suites -- every test suite that is moved into a matrix adds additional overhead in the 1 minute `prepare-end-to-end` step. Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1367 Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
96 lines
2.9 KiB
YAML
96 lines
2.9 KiB
YAML
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- closed
|
|
|
|
jobs:
|
|
save-cache:
|
|
runs-on: docker
|
|
container:
|
|
image: data.forgejo.org/oci/node:20-bookworm
|
|
steps:
|
|
- name: cache restore
|
|
id: cachestep1
|
|
uses: https://data.forgejo.org/actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
/usr/local/bin/something
|
|
key: cachekey-${{ forge.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: cache hit
|
|
run: |
|
|
set -x
|
|
test "${{ steps.cachestep1.outputs.cache-hit }}" != true
|
|
|
|
- name: create something
|
|
run: echo SOMETHING > /usr/local/bin/something
|
|
|
|
- name: cache save
|
|
uses: https://data.forgejo.org/actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
/usr/local/bin/something
|
|
key: ${{ steps.cachestep1.outputs.cache-primary-key }}
|
|
|
|
restore-cache:
|
|
runs-on: docker
|
|
needs: [save-cache]
|
|
container:
|
|
image: data.forgejo.org/oci/node:20-bookworm
|
|
steps:
|
|
- name: cache restore
|
|
id: cachestep2
|
|
uses: https://data.forgejo.org/actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
/usr/local/bin/something
|
|
key: cachekey-${{ forge.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: verify something
|
|
run: |
|
|
set -x
|
|
test SOMETHING = $(cat /usr/local/bin/something)
|
|
|
|
- name: cache hit
|
|
run: |
|
|
set -x
|
|
test "${{ steps.cachestep2.outputs.cache-hit }}" = true
|
|
|
|
test:
|
|
runs-on: docker
|
|
needs: [restore-cache]
|
|
container:
|
|
image: data.forgejo.org/oci/node:20-bookworm
|
|
options: "--volume /srv/example:/srv/example"
|
|
|
|
steps:
|
|
- name: setup
|
|
shell: bash
|
|
run: |
|
|
set -x
|
|
test $FORGEJO_TOKEN = ${{ env.FORGEJO_TOKEN }}
|
|
test $FORGEJO_TOKEN = ${{ forge.token }}
|
|
export DEBIAN_FRONTEND=noninteractive ; apt-get -qq update ; apt-get install -y -qq curl git >& /dev/null
|
|
curl -sS -o /usr/local/bin/forgejo-curl.sh https://code.forgejo.org/forgejo/forgejo-curl/raw/branch/main/forgejo-curl.sh && chmod +x /usr/local/bin/forgejo-curl.sh
|
|
forgejo-curl.sh --token "$FORGEJO_TOKEN" login $FORGEJO_SERVER_URL
|
|
forgejo-curl.sh api_json $FORGEJO_SERVER_URL/api/v1/user
|
|
|
|
- name: determine if the PR is from a fork
|
|
id: forked
|
|
run: |
|
|
set -x
|
|
if test ${{ forge.event.pull_request.base.repo.full_name }} = ${{ forge.event.pull_request.head.repo.full_name }} ; then
|
|
echo value=false >> $FORGEJO_OUTPUT
|
|
else
|
|
echo value=true >> $FORGEJO_OUTPUT
|
|
fi
|
|
|
|
- name: save event
|
|
run: |
|
|
set -x
|
|
d=/srv/example/cache-pull-request/contexts/${{ forgejo.event.pull_request.head.repo.owner.username }}/$FORGEJO_EVENT_NAME
|
|
mkdir -p $d
|
|
cat > $d/forgejo-${{ forgejo.event.action }} <<'EOF'
|
|
${{ toJSON(forgejo) }}
|
|
EOF
|