Skip to content

Commit 5b326cf

Browse files
committed
[New Feature] (config) Add new GitHub Action reusable workflow about pre-test before building package.
1 parent 5126338 commit 5b326cf

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
##############################################################################################
2+
#
3+
# Workflow Description:
4+
# Build the Python source code to be Python package.
5+
#
6+
# Workflow input parameters:
7+
# * General arguments:
8+
# * upload_artifact_name: The option 'name' of reusable action 'actions/upload-artifact@v3'.
9+
# * upload_artifact_path: The option 'path' of reusable action 'actions/upload-artifact@v3'.
10+
#
11+
# Workflow running output:
12+
# No and do nothing.
13+
#
14+
##############################################################################################
15+
16+
name: Build and compile the code to be Python package
17+
18+
on:
19+
workflow_call:
20+
inputs:
21+
python_package_name:
22+
description: "The Python package name."
23+
required: true
24+
type: string
25+
test_import_package_code_1:
26+
description: "Test for importing the Python package."
27+
required: true
28+
type: string
29+
test_import_package_code_2:
30+
description: "Test for importing the Python package."
31+
required: false
32+
type: string
33+
test_import_package_code_3:
34+
description: "Test for importing the Python package."
35+
required: false
36+
type: string
37+
test_python_script:
38+
description: "Run a Python script for testing the Python package."
39+
required: false
40+
type: string
41+
42+
43+
jobs:
44+
pre-building_check:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
50+
- name: Setup Python 3.10 in Ubuntu OS
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: '3.10'
54+
55+
- name: Install Python dependencies
56+
run: |
57+
python3 -m pip install --upgrade pip
58+
pip3 install -U pip
59+
pip3 install -U setuptools
60+
pip3 install wheel
61+
pip install -U -r ./requirements/requirements-test.txt
62+
63+
- name: Install SmoothCrawler with by setup.py
64+
run: python3 setup.py install --user || exit 1
65+
66+
- name: Show the Python package information
67+
run: pip3 show ${{ inputs.python_package_name }}
68+
69+
- name: Test to run script with package '${{ inputs.python_package_name }}' in command lines
70+
run: |
71+
${{ inputs.test_import_package_code_1 }}
72+
${{ inputs.test_import_package_code_2 }}
73+
${{ inputs.test_import_package_code_3 }}
74+
shell: python
75+
76+
- name: Test to run script with package '${{ inputs.python_package_name }}' with Python file
77+
run: python3 ${{ inputs.test_python_script }}
78+

0 commit comments

Comments
 (0)