-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
105 lines (92 loc) · 3.92 KB
/
action.yaml
File metadata and controls
105 lines (92 loc) · 3.92 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
name: "Operate PyFake-API-Server"
description: "Operate PyFake-API-Server by command line."
author: "Bryant Liu"
inputs:
server-type:
description: "The API server type for PyFake-API-Server to operate."
required: false
default: ""
operation:
description: "The subcommand line of the API server type to do some operations. [options: run,get,add,check,pull,sample]"
required: false
default: ""
operation-options:
description: "The command line options of the subcommand line with the API server type to do some operations."
required: false
default: ""
directly-command-line:
description: "The entire command line of the PyFake-API-Server to run (without prefix command line *fake*)."
required: false
default: ""
apply-version:
description: "The entire command line of the PyFake-API-Server to run (without prefix command line *fake*). [options: stable,latest]"
required: false
default: "stable"
runs:
using: "composite"
steps:
- name: Fail-fast in unsupported environments
if: runner.os == 'Windows'
shell: bash -eEuo pipefail {0}
run: |
>&2 echo This action is only able to run under GNU/Linux or Apple MacOS environments
exit 1
- name: Install Python 3.12 for running Fake-API-Server
uses: actions/setup-python@v6
with:
python-version: '3.12'
############### The workflow for latest version of PyFake-API-Server ###############
- name: Checkout Fake-API-Server GitHub repository
if: inputs.apply-version == 'latest'
uses: actions/checkout@v6
with:
repository: 'Chisanan232/PyFake-API-Server'
ref: 'master'
- name: Install Python dependencies for Fake-API-Server by *Poetry* for latest version source code
if: inputs.apply-version == 'latest'
shell: bash
run: |
pip --version
pip install -U poetry
pip list
echo "[INFO] Poetry version:"
poetry --version
echo "[INFO] Install dependencies by Poetry:"
poetry install
- name: Show the Fake-API-Server version info
if: inputs.apply-version == 'latest'
shell: bash
run: poetry run fake --version
- name: Run Fake-API-Server with ${{ inputs.operation }} under ${{ inputs.server-type }}
if: inputs.apply-version == 'latest' && inputs.server-type != '' && inputs.operation != '' && inputs.operation-options != ''
shell: bash
run: poetry run fake ${{ inputs.server-type }} ${{ inputs.operation }} ${{ inputs.operation-options }}
- name: Run Fake-API-Server by directory command line
if: inputs.apply-version == 'latest' && inputs.directly-command-line != ''
shell: bash
run: poetry run fake ${{ inputs.directly-command-line }}
############################# end for latest version ###############################
############### The workflow for latest version of PyFake-API-Server ###############
- name: Install Python dependencies for Fake-API-Server by *pip* directly
if: inputs.apply-version == 'stable'
shell: bash
run: |
pip --version
pip install -U "fake-api-server[all]"
pip list
- name: Show the Fake-API-Server version info
if: inputs.apply-version == 'stable'
shell: bash
run: fake --version
- name: Run Fake-API-Server with ${{ inputs.operation }} under ${{ inputs.server-type }}
if: inputs.apply-version == 'stable' && inputs.server-type != '' && inputs.operation != '' && inputs.operation-options != ''
shell: bash
run: fake ${{ inputs.server-type }} ${{ inputs.operation }} ${{ inputs.operation-options }}
- name: Run Fake-API-Server by directory command line
if: inputs.apply-version == 'stable' && inputs.directly-command-line != ''
shell: bash
run: fake ${{ inputs.directly-command-line }}
############################# end for stable version ###############################
branding:
icon: server
color: 'black'