Merge pull request #234 from soodrohit/scratch/makefile #404
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |