-
-
Notifications
You must be signed in to change notification settings - Fork 72
157 lines (133 loc) · 5.67 KB
/
w10-workflow-features-test.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
# """
# The MIT License (MIT)
# Copyright (c) 2023 pkjmesra
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# """
name: 10. New Features - Tests
env:
package_name: pkscreener
on:
push:
branches: [ new-features ]
# pull_request:
# branches: [ new-features ]
workflow_dispatch:
inputs:
name:
description: 'Run Details'
required: false
default: 'New Features Tests'
branch-name:
description: 'Branch name'
required: false
default: ''
targetPythonVersion:
description: 'Target Python version: 3.9 , 3.10, 3.11 ?'
required: false
type: string
default: '3.11'
jobs:
# Lint the source-code
Lint-Source:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# run: echo "'${{ github.ref_name }}' was pushed by '${{ github.event.pusher.name }}'"
with:
ref: ${{ inputs.branch-name || github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.targetPythonVersion || 3.11 }}
- name: Restore Dependencies from Cache
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Lint with flake8
run: |
python3 -m pip install --upgrade pip
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
Test-Source:
uses: pkjmesra/PKScreener/.github/workflows/w11-workflow-test-coverage.yml@main
with:
branch-name: ${{ inputs.branch-name }}
secrets: inherit
Call-prod-scan-test-workflow:
uses: pkjmesra/PKScreener/.github/workflows/w5-workflow-prod-scans_Tests.yml@main
with:
branch-name: ${{ inputs.branch-name }}
secrets: inherit
# Job to create PR
Create-Pull-Request:
if: ${{ inputs.branch-name }} != 'main' && ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [Test-Source, Lint-Source, Call-prod-scan-test-workflow]
steps:
- name: Checkout Repo before PR
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch-name }}
- name: Create Pull Request ( ${{ inputs.branch-name }} -> main)
id: create_pr
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ inputs.branch-name }}
destination_branch: "main"
pr_title: "[pkscreener Test] New Features Added - Test Passed"
pr_body: |
**This PR has been generated automatically** by **pkscreener Test - New Features** workflow due to test passed for a latest push on the **new-features** branch.
View commits for changelog.
pr_label: "Test-Passed"
pr_draft: false
pr_allow_empty: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create PR Log file
shell: bash
run: |
echo ${{steps.create_pr.outputs.pr_url}} >> pr.txt
echo ${{steps.create_pr.outputs.pr_number}} >> pr.txt
- name: Save PR Log File
uses: actions/upload-artifact@v3
with:
name: PR_Log.txt
path: pr.txt
# Delete_Workflow_Run:
# runs-on: ubuntu-20.04
# needs: [Test-Source]
# name: Delete workflow run
# steps:
# - uses: actions/checkout@v4
# with:
# ref: main
# - name: Delete this workflow run
# if: startsWith(runner.os, 'Linux')
# shell: bash
# run: |
# for id in $(gh run list --limit 100 --jq ".[] | select (.status == \"success\" ) | .databaseId" --json databaseId,status); do gh run delete $id; done
# for id in $(gh run list --limit 100 --jq ".[] | select (.status == \"cancelled\" ) | .databaseId" --json databaseId,status); do gh run delete $id; done
# for id in $(gh run list --limit 100 --jq ".[] | select (.status == \"failure\" ) | .databaseId" --json databaseId,status); do gh run delete $id; done
# # Cancel runs queued or in_progress. See https://cli.github.com/manual/gh_run_list
# # for id in $(gh run list -w "13. Backtest for Generic" --limit 100 --jq ".[] | select (.status == \"queued\" ) | .databaseId" --json databaseId,status); do gh run cancel $id; done
# env:
# GH_TOKEN : ${{secrets.GITHUB_TOKEN}}