-
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (111 loc) · 3.83 KB
/
ci.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
name: CI
on:
push:
branches:
- master
paths-ignore:
- "**/coverage.svg"
pull_request:
branches:
- master
paths-ignore:
- "**/coverage.svg"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
ci:
name: Run Test and Review PR
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Setup Python 3.11 🐍
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: "pipenv"
- name: Install lcov
run: sudo apt-get update && sudo apt-get install -y lcov
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install Dependencies 📥
run: |
pipenv install
pipenv shell
- name: Run Tests 🧪
run: pytest --cov --cov-report=lcov:coverage.lcov
- name: Coverage Badge
uses: ImBIOS/lcov-coverage-badge@v1
with:
file: ./coverage.lcov
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: "coverage.svg"
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "Updated coverage.svg"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}
- name: Create Assets Folder 📥
run: mkdir assets
- name: Create Previous Comments 🫣
uses: int128/hide-comment-action@v1
with:
starts-with: "README stats current output:"
- name: Run Action Preview on Current Code 🧪
id: make-stats
env:
INPUT_GH_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }}
INPUT_WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
INPUT_SHOW_TIMEZONE: True
INPUT_SHOW_PROJECTS: True
INPUT_SHOW_EDITORS: True
INPUT_SHOW_OS: True
INPUT_SHOW_LANGUAGE: True
INPUT_SYMBOL_VERSION: 1
INPUT_SHOW_LINES_OF_CODE: True
INPUT_SHOW_LOC_CHART: True
INPUT_SHOW_PROFILE_VIEWS: True
INPUT_SHOW_TOTAL_CODE_TIME: True
INPUT_SHOW_SHORT_INFO: True
INPUT_SHOW_COMMIT: True
INPUT_SHOW_DAYS_OF_WEEK: True
INPUT_SHOW_LANGUAGE_PER_REPO: True
INPUT_SHOW_UPDATED_DATE: True
INPUT_COMMIT_BY_ME: True
INPUT_DEBUG_LOGGING: True # Not for prod
DEBUG_RUN: True # Not for prod
run: python3 sources/main.py
- name: Save Branch Name Without Slashes 📛
if: ${{ github.ref != 'refs/heads/master' }}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
BRANCH_NAME=${{ env.BRANCH_NAME }}
BRANCH_NAME=${BRANCH_NAME////_}
echo BRANCH_NAME=${BRANCH_NAME} >> $GITHUB_ENV
- name: Upload Artifact 📦
uses: actions/upload-artifact@v3
if: ${{ github.ref != 'refs/heads/master' }}
with:
name: ${{ format('github-pages-for-branch-{0}', env.BRANCH_NAME) }}
path: assets
- name: Create Comment 💬
uses: jungwinter/comment@v1
with:
type: create
body: ${{ steps.make-stats.outputs.README_CONTENT }}
issue_number: ${{ github.event.number }}
token: ${{ secrets.GITHUB_TOKEN }}