-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.31 KB
/
run-pipeline.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
name: Lexer-Parser Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-run:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set Up Dependencies
run: |
sudo apt-get update
sudo apt-get install -y flex bison gcc make
- name: Compile Lexer and Parser
run: |
cd src
flex lexer.l
bison -d parser.y
gcc -o program parser.tab.c lex.yy.c -lm
- name: Run Program and Capture Text Output
run: |
./src/program < input.txt > output.txt
cat output.txt # Print the text output to the logs
- name: Check Text Output
run: |
if [ ! -f output.txt ]; then
echo "Text output not generated!"
exit 1
fi
- name: Upload Text Output as Artifact
uses: actions/upload-artifact@v4
with:
name: text-output
path: output.txt
- name: Commit and Push Output to Repository
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add output.txt
git commit -m "Add generated text output file"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}