-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (45 loc) · 1.64 KB
/
run_tests.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
name: Execute test cases and send to README
on: # run on commits to the main branch
push:
branches:
- main
workflow_dispatch: # run when triggered manually
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v4 # checkout the repository content
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11' # install the python version needed
- name: Install packages
run: pip install cvxpy
- name: Configure Git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Execute python script first case
run: python linear_program.py 3 20 25 1
- name: Execute python script second case
run: python linear_program.py 5 15 40 2
- name: Execute python script third case
run: python linear_program.py 1 40 20 3
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "Changes found"
- name: Stage files
if: steps.git-check.outputs.return-code == '0'
run: git add .
- name: Commit changed files
if: steps.git-check.outputs.return-code == '0'
run: |
git commit -m "🤖 run python script" || echo "No changes to commit"
- name: Fetch from main
if: steps.git-check.outputs.return-code == '0'
run: git fetch origin main
- name: Push code to main
if: steps.git-check.outputs.return-code == '0'
run: git push origin HEAD:main