workflow creation #12
Workflow file for this run
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
name: Lexer-Parser Pipeline | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
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 Script_Interpreter | |
flex lexer.l | |
bison -d parser.y | |
gcc -o program parser.tab.c lex.yy.c -lm | |
- name: Prepare Output Directory | |
run: mkdir -p Screenshots | |
- name: Run Program and Capture Text Output | |
run: | | |
./Script_Interpreter/program < input/input.txt > Screenshots/output.txt | |
cat Screenshots/output.txt # Print the text output to the logs | |
- name: Check Text Output | |
run: | | |
if [ ! -f Screenshots/output.txt ]; then | |
echo "Text output not generated!" | |
exit 1 | |
fi | |
- name: List Files in Screenshots | |
run: ls -l Screenshots | |
- name: Upload Text Output as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: text-output | |
path: Screenshots/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 Screenshots/ | |
git commit -m "Add generated text output file to Screenshots folder" | |
git push /~https://github.com/EchoSingh/Sanskrit_Programming_Script.git HEAD:master | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |