mirror of
https://code.forgejo.org/actions/forgejo-release
synced 2026-02-11 09:09:24 +00:00
add tests
This commit is contained in:
parent
8dc53bb34f
commit
579af53e4c
7 changed files with 91 additions and 0 deletions
|
|
@ -48,6 +48,37 @@ jobs:
|
|||
|
||||
test $(cat /tmp/v1.json | jq -r .hide_archive_links) = true
|
||||
|
||||
- name: testdata/release-notes-file
|
||||
run: |
|
||||
export LOOP_DELAY=30
|
||||
export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}"
|
||||
forgejo-test-helper.sh run_workflow testdata/release-notes-file http://testuser:admin1234@${{ steps.forgejo.outputs.host-port }} testuser upload-download forgejo-release "${{ steps.forgejo.outputs.token }}"
|
||||
|
||||
set -ex
|
||||
export FORGEJO="${{ steps.forgejo.outputs.url }}"
|
||||
curl --fail -sS $FORGEJO/api/v1/repos/testuser/release-notes-file/releases/tags/v1.0 > /tmp/v1.json
|
||||
curl --fail -sS $FORGEJO/api/v1/repos/testuser/release-notes-file/releases/tags/v2.0 > /tmp/v2.json
|
||||
curl --fail -sS $FORGEJO/api/v1/repos/testuser/release-notes-file/releases/tags/v3.0 > /tmp/v3.json
|
||||
|
||||
EXPECTED='# This is a Release Note
|
||||
|
||||
Some *formatted*,
|
||||
|
||||
multiline
|
||||
|
||||
Markdown content.
|
||||
|
||||
```bash
|
||||
echo "Even a code block"
|
||||
```'
|
||||
test "$EXPECTED" = "$(jq -r .body < /tmp/v1.json)"
|
||||
|
||||
test "$EXPECTED" = "$(jq -r .body < /tmp/v2.json)"
|
||||
test "I wont be there" != "$(jq -r .body < /tmp/v2.json)"
|
||||
|
||||
test "$EXPECTED" != "$(jq -r .body < /tmp/v3.json)"
|
||||
test "I will be there" = "$(jq -r .body < /tmp/v3.json)"
|
||||
|
||||
- name: testdata/upload-download-private
|
||||
run: |
|
||||
export LOOP_DELAY=30
|
||||
|
|
|
|||
44
testdata/release-notes-file/.forgejo/workflows/test.yml
vendored
Normal file
44
testdata/release-notes-file/.forgejo/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
name: Upload a release with Release Notes to the project that runs the workflow
|
||||
on: [push]
|
||||
jobs:
|
||||
upload-download:
|
||||
runs-on: lxc-bookworm
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
id: release-notes-file
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
direction: upload
|
||||
tag: v1.0
|
||||
token: FORGEJO_TEST_TOKEN
|
||||
release-dir: upload-dir
|
||||
release-notes-file: upload-dir/RELEASE_NOTES.md
|
||||
verbose: true
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
id: release-notes-file-takes-precedence
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
direction: upload
|
||||
tag: v2.0
|
||||
token: FORGEJO_TEST_TOKEN
|
||||
release-dir: upload-dir
|
||||
release-notes: "I wont be there"
|
||||
release-notes-file: upload-dir/RELEASE_NOTES.md
|
||||
verbose: true
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
id: release-notes
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
direction: upload
|
||||
tag: v3.0
|
||||
token: FORGEJO_TEST_TOKEN
|
||||
release-dir: upload-dir
|
||||
release-notes: "I will be there"
|
||||
verbose: true
|
||||
1
testdata/release-notes-file/.gitignore
vendored
Normal file
1
testdata/release-notes-file/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*~
|
||||
12
testdata/release-notes-file/upload-dir/RELEASE_NOTES.md
vendored
Normal file
12
testdata/release-notes-file/upload-dir/RELEASE_NOTES.md
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# This is a Release Note
|
||||
|
||||
Some *formatted*,
|
||||
|
||||
multiline
|
||||
|
||||
Markdown content.
|
||||
|
||||
```bash
|
||||
echo "Even a code block"
|
||||
```
|
||||
|
||||
1
testdata/release-notes-file/upload-dir/file 3.txt
vendored
Normal file
1
testdata/release-notes-file/upload-dir/file 3.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
FILE3
|
||||
1
testdata/release-notes-file/upload-dir/file1.txt
vendored
Normal file
1
testdata/release-notes-file/upload-dir/file1.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
FILE1
|
||||
1
testdata/release-notes-file/upload-dir/file2.txt
vendored
Normal file
1
testdata/release-notes-file/upload-dir/file2.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
FILE2
|
||||
Loading…
Reference in a new issue