-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (100 loc) · 4.33 KB
/
Copy pathtest.yml
File metadata and controls
114 lines (100 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI Test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # Allows manual triggering
permissions:
contents: read # Needed to checkout the code
jobs:
test-action:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Test on common OSes. Add more if nsyte supports them and has releases.
os: [ubuntu-latest, macos-latest, windows-latest]
# Use 'latest' to test the version resolution logic
version: ['latest']
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup dummy directory and secret
shell: bash
run: |
mkdir test-dist
echo "<html>Test index.html</html>" > test-dist/index.html
echo "<html>Test fallback.html</html>" > test-dist/fallback.html
echo "DUMMY_NBUNKSEC=nbunksec1fakebunkersecretstringforactiontestingpurposesonly" >> $GITHUB_ENV
echo "DUMMY_SEC1=sec1fakeprivatekeystringforvalidationtestingonly" >> $GITHUB_ENV
- name: Run nsite-action (Local Path)
uses: ./
id: test_run
env:
GH_TOKEN: ${{ github.token }}
with:
nbunksec: ${{ env.DUMMY_NBUNKSEC }}
directory: './test-dist'
version: ${{ matrix.version }}
relays: |
wss://nostr.example.com
wss://relay.example.org
servers: |
https://blossom.example.com
force: true
verbose: true
fallback: '/fallback.html'
concurrency: 2
continue-on-error: true # Expect failure with dummy signing secret/relays/servers
- name: Reject sec1 value in nbunksec input
uses: ./
id: reject_sec1
env:
GH_TOKEN: ${{ github.token }}
with:
nbunksec: ${{ env.DUMMY_SEC1 }}
directory: './test-dist'
version: ${{ matrix.version }}
continue-on-error: true
- name: Verify Action Attempted Run
shell: bash
run: |
echo "Action step outcome: ${{ steps.test_run.outcome }}"
echo "Action step conclusion: ${{ steps.test_run.conclusion }}"
echo "Action outputs from test_run step:"
echo " Status: ${{ steps.test_run.outputs.status }}"
echo " nsyte Version Used: ${{ steps.test_run.outputs.nsyte_version_used }}"
if [[ "${{ steps.test_run.outcome }}" != "failure" ]]; then
echo "::error::Expected the action step outcome to be 'failure' when nsyte exits non-zero, but got '${{ steps.test_run.outcome }}'."
exit 1
else
echo "Action step outcome correctly reported as 'failure'."
fi
if [[ -z "${{ steps.test_run.outputs.nsyte_version_used }}" ]]; then
echo "::error::Output 'nsyte_version_used' was NOT set."
exit 1
else
echo "Output 'nsyte_version_used' IS SET to: ${{ steps.test_run.outputs.nsyte_version_used }}"
fi
# Now that nsyte_version_used is confirmed, check status and version string
if [[ "${{ steps.test_run.outputs.status }}" != "failure" ]]; then
echo "::error::Expected status 'failure' due to dummy inputs, but got '${{ steps.test_run.outputs.status }}' or it was empty."
exit 1
else
echo "Status output correctly set to 'failure'."
fi
# Check if the version used resolves to the current latest stable release when input is 'latest'
if [[ "${{ matrix.version }}" == "latest" && "${{ steps.test_run.outputs.nsyte_version_used }}" != "v0.23.0" ]]; then
echo "::warning::Latest stable version detected was ${{ steps.test_run.outputs.nsyte_version_used }}, expected v0.23.0. Check nsyte release tagging or the action's version resolution logic."
# Not failing the test for this warning, but it's important to note.
fi
if [[ "${{ steps.reject_sec1.outcome }}" != "failure" ]]; then
echo "::error::Expected the invalid nbunksec step to fail, but got '${{ steps.reject_sec1.outcome }}'."
exit 1
else
echo "Invalid nbunksec value was correctly rejected."
fi
echo "Verification passed: Outputs are populated, and status is 'failure' as expected with dummy inputs."