Skip to content

Commit 59ffa86

Browse files
smoke tests for forgejo
1 parent 44a85b5 commit 59ffa86

File tree

2 files changed

+96
-1
lines changed

2 files changed

+96
-1
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: '[Forgejo] Smoke Tests'
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
smoke-test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
args:
15+
- "--invites"
16+
- "--commits"
17+
- "--pull_requests"
18+
- "--issues"
19+
- "--wikis"
20+
- "--contributors"
21+
- "--workflow_runs"
22+
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Cache pip
29+
uses: actions/cache@v3
30+
with:
31+
path: ~/.cache/pip
32+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-
35+
36+
- name: Install dependencies
37+
run: pip install -r requirements.txt
38+
39+
- name: Create list.txt
40+
run: echo "harabat/pyforgejo" > list.txt
41+
42+
- name: Run test
43+
run: |
44+
python3 main.py ${{ matrix.args }} --token ${{ secrets.TEST_TOKEN_FORGEJO }} --list list.txt --out out.csv --branch master
45+
46+
- name: Check if out.csv exists
47+
run: ls out.csv
48+
49+
- name: Fail if out.csv does not exist
50+
if: failure()
51+
run: exit 1
52+
53+
- name: Show out.csv
54+
run: cat out.csv
55+
56+
- name: Check header in first line
57+
run: |
58+
case "${{ matrix.args }}" in
59+
--invites)
60+
HEADER="repository name,invited login,invite creation date,invitation url"
61+
;;
62+
--commits)
63+
HEADER="repository name,author name,author login,author email,date and time,changed files,commit id,branch"
64+
;;
65+
--pull_requests)
66+
HEADER="repository name,title,id,state,commit into,commit from,created at,creator name,creator login,creator email,changed files,comment body,comment created at,comment author name,comment author login,comment author email,merger name,merger login,merger email,source branch,target branch,assignee story,related issues,labels,milestone"
67+
;;
68+
--issues)
69+
HEADER="repository name,number,title,state,task,created at,creator name,creator login,creator email,closer name,closer login,closer email,closed at,comment body,comment created at,comment author name,comment author login,comment author email,assignee story,connected pull requests,labels,milestone"
70+
;;
71+
--wikis)
72+
HEADER="repository name,author name,author login,datetime,page,action,revision id,added lines,deleted lines"
73+
;;
74+
--contributors)
75+
HEADER="repository name,login,name,email,url,permissions,total commits,node id,type,bio,site admin"
76+
;;
77+
--workflow_runs)
78+
HEADER="repository name,display title,event,head branch,head sha,name,path,started at,total duration,conclusion,status,url"
79+
;;
80+
*)
81+
echo "Unknown ARG: '${{ matrix.args }}'"
82+
exit 1
83+
;;
84+
esac
85+
86+
FIRST_LINE=$(head -n 1 out.csv)
87+
88+
if [[ "$FIRST_LINE" == "$HEADER"* ]]; then
89+
echo "Header is valid for ${{ matrix.args }}"
90+
else
91+
echo "::error::Header is invalid for ${{ matrix.args }}"
92+
echo "Expected: $HEADER"
93+
echo "Actual: $FIRST_LINE"
94+
exit 1
95+
fi

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Smoke Tests
1+
name: '[Github] Smoke Tests'
22

33
on:
44
push:

0 commit comments

Comments
 (0)