-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode-quality-checks-and-tests.yaml
More file actions
97 lines (91 loc) · 3.21 KB
/
code-quality-checks-and-tests.yaml
File metadata and controls
97 lines (91 loc) · 3.21 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
name: Code Quality Checks, Tests, and Push Tags
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
workflow_dispatch:
jobs:
check-version-txt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Tag with the release version
run: |
git tag $(cat version.txt)
lint-format-and-static-code-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: 'pip' # caching pip dependencies
- name: Install pre-commit
run: pip install pre-commit
- name: Lint, Format, and Static Code Quality Checks
run: |
/bin/bash -x run.sh lint:ci
execute-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install test dependencies
run: make install
- name: Set up Git
run: |
git config --global user.email "avr13405@gmail.com"
git config --global user.name "Amit Vikram Raj"
- name: Run tests
run: make test
push-tags:
needs:
- execute-tests
- lint-format-and-static-code-checks
- check-version-txt
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Push Tags
run: |
git tag $(cat version.txt)
git push origin --tags
# https://docs.github.com/en/actions/learn-github-actions/contexts#example-printing-context-information-to-the-log
dump-contexts-to-log:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
id: github_context_step
run: echo '{% raw %}${{ toJSON(github) }}'{% endraw %}
- name: Dump job context
run: echo '{% raw %}${{ toJSON(job) }}'{% endraw %}
- name: Dump steps context
run: echo '{% raw %}${{ toJSON(steps) }}'{% endraw %}
- name: Dump runner context
run: echo '{% raw %}${{ toJSON(runner) }}'{% endraw %}
- name: Dump strategy context
run: echo '{% raw %}${{ toJSON(strategy) }}'{% endraw %}
- name: Dump matrix context
run: echo '{% raw %}${{ toJSON(matrix) }}'{% endraw %}
- name: Dump secrets
run: echo '{% raw %}${{ toJSON(secrets) }}'{% endraw %}
- name: Dump vars
run: echo '{% raw %}${{ toJSON(vars) }}'{% endraw %}