-
Notifications
You must be signed in to change notification settings - Fork 208
127 lines (101 loc) · 3.41 KB
/
workflow-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
# Project : Screenipy
# Author : Pranjal Joshi
# Created : 27/04/2021
# Description : Workflow for CI - Testing source and PR main for release
name: Screenipy Test - New Features
on:
push:
branches: [ new-features ]
pull_request:
branches: [ new-features ]
jobs:
# Test the source-code
Test-Source:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11.6
uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Restore Dependencies from Cache
uses: actions/cache@v2
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies using pip
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-mock
pip install -r requirements.txt
pip install --no-deps advanced-ta
- name: Lint with flake8
run: |
# 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
- name: Run a Test with pytest
run: |
cd test/
pytest -v
Dev-Docker-Build:
runs-on: ubuntu-latest
# needs: [Test-Source]
steps:
- uses: actions/checkout@v4
with:
ref: new-features
# Setup hardware emulator using QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Setup Docker Buildx for multi-arch images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Streamlit Build and Push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: joshipranjal/screeni-py:dev
# Job to create PR
Create-Pull-Request:
runs-on: ubuntu-latest
needs: [Test-Source]
steps:
- name: Checkout Repo before PR
uses: actions/checkout@v4
with:
ref: new-features
- name: Create Pull Request (new-features -> main)
id: create_pr
uses: repo-sync/pull-request@v2
with:
source_branch: "new-features"
destination_branch: "main"
pr_title: "[Screenipy Test] New Features Added - Test Passed"
pr_body: |
**This PR has been generated automatically** by **Screenipy 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@v2
with:
name: PR_Log.txt
path: pr.txt