-
Notifications
You must be signed in to change notification settings - Fork 10
199 lines (196 loc) · 6.85 KB
/
pkgs-action.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: RT-Thread_Packages_Test
on:
workflow_call:
inputs:
rt-thread-versions:
description: "String containing the versions of RT-thread (separated by spaces)."
default: "branch:master tag:v4.1.1"
required: false
type: string
rt-thread-repository:
description: "RT-Thread repository."
default: "RT-Thread/rt-thread"
required: false
type: string
pkgs-test-repository:
description: "pkgs-test repository (for pkgs-test debug only)."
default: "RT-Thread/pkgs-test"
required: false
type: string
pkgs-test-branch:
description: "pkgs-test branch (for pkgs-test debug only)."
default: "main"
required: false
type: string
bsps:
description: "String containing the bsps ([bsp-name]:[toolchain], separated by spaces)."
default: "qemu-vexpress-a9:sourcery-arm stm32/stm32h750-artpi:sourcery-arm k210:sourcery-riscv-none-embed"
required: false
type: string
pkgs:
description: "String containing the pkgs ( separated by \\n or spaces)."
default: "hello"
required: false
type: string
test-specific-pkgs:
description: "Test specific packages."
default: false
required: false
type: boolean
package-repository:
description: "Package repository to test."
default: ${{ github.repository }}
required: false
type: string
package-test-nolatest:
description: "Do not test the latest version of the package."
default: false
required: false
type: boolean
package-test-all:
description: "test the all of the package in RT-Thread/packages."
default: false
required: false
type: boolean
package-append-res:
description: "Append test res to old res from githubpage."
default: false
required: false
type: boolean
check-errors:
description: "Choose whether to check for errors."
default: true
required: false
type: boolean
pages-url:
description: "Pkgs test res github pages url."
default: "https://rt-thread.github.io/packages/"
required: false
type: string
deploy-pages:
description: "Choose whether to deploy pages."
default: false
required: false
type: boolean
qemu-check:
description: "Choose whether run qemu check."
default: false
required: false
type: boolean
jobs:
packages-test:
name: ${{ github.repository }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@main
with:
path: repository
- uses: actions/checkout@main
with:
repository: '${{ inputs.pkgs-test-repository }}'
ref: '${{ inputs.pkgs-test-branch }}'
path: pkgs-test
- name: Install Tools
shell: bash
run: |
sudo apt update -y
sudo apt install python3 python3-pip gcc git libncurses5-dev tree qemu-system-arm -y
python3 -m pip install scons==4.4.0 requests tqdm wget dominate PyGithub requests pytz psutil kconfiglib
- name: Copy RT-Thread/packages to env
if: "${{ endsWith(github.repository, '/packages') == true }}"
shell: bash
run: |
cd ${{ github.workspace }}
mkdir -p ./pkgs-test/env/packages
cp -r ./repository ./pkgs-test/env/packages/packages
- name: Copy RT-Thread/rt-thread(master) to rtthread/master
if: "${{ endsWith(github.repository, '/rt-thread') == true }}"
shell: bash
run: |
cd ${{ github.workspace }}
mkdir -p ./pkgs-test/rtthread/
cp -r ./repository ./pkgs-test/rtthread/master
- name: Install Test Resources
shell: bash
run: |
cd ${{ github.workspace }}/pkgs-test
python pkgs-test.py config --rtthread='${{ inputs.rt-thread-versions }}'
python pkgs-test.py config --bsps='${{ inputs.bsps }}'
if [[ ${{ inputs.test-specific-pkgs}} == true ]]; then
python pkgs-test.py config --pkgs='${{ inputs.pkgs }}'
fi
python pkgs-test.py download
- name: Carry Out Packages Test
shell: bash
run: |
cd ${{ github.workspace }}/pkgs-test
echo 'Carry Out Packages Test.'
if [[ ${{ inputs.package-test-all}} == true ]]; then
COMMAND="python pkgs-test.py --pkg=all"
elif [[ ${{ inputs.test-specific-pkgs}} == true ]]; then
COMMAND="python pkgs-test.py"
else
COMMAND="python pkgs-test.py --repository=${{ inputs.package-repository }}"
fi
if [[ ${{ inputs.package-test-nolatest}} == true ]]; then
echo 'nolatest.'
COMMAND="$COMMAND --nolatest"
fi
if [[ ${{ inputs.package-append-res}} == true ]]; then
echo 'Append test res to old res from githubpage.'
COMMAND="$COMMAND --append_res --pages_url='${{ inputs.pages-url}}'"
fi
if [[ ${{ inputs.qemu-check}} == true ]]; then
echo 'Append test res to old res from githubpage.'
COMMAND="$COMMAND --qemu"
fi
echo "$COMMAND"
eval "$COMMAND"
- uses: actions/upload-artifact@main
with:
name: artifacts_export
path: ${{ github.workspace }}/pkgs-test/artifacts_export
check-errors:
runs-on: ubuntu-22.04
needs: packages-test
if: "${{ inputs.check-errors }}"
steps:
- uses: actions/checkout@main
with:
repository: '${{ inputs.pkgs-test-repository }}'
ref: '${{ inputs.pkgs-test-branch }}'
- name: Download artifacts_export
uses: actions/download-artifact@main
with:
name: artifacts_export
- name: Install Tools
shell: bash
run: |
sudo apt install python3 python3-pip -y
python3 -m pip install requests tqdm wget dominate PyGithub requests pytz kconfiglib
- name: Packages test whether or not error
shell: bash
run: |
python pkgs-test.py check --file='pkgs_res_single.json'
Deploy-Pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: packages-test
if: "${{ inputs.deploy-pages }}"
steps:
- name: Download artifacts_export
uses: actions/download-artifact@main
with:
name: artifacts_export
- name: Setup Pages
uses: actions/configure-pages@main
- name: Upload artifact
uses: actions/upload-pages-artifact@main
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2