Skip to content

[CI] Integrate CI with the minishell tester #4

[CI] Integrate CI with the minishell tester

[CI] Integrate CI with the minishell tester #4

Workflow file for this run

name: Build and Test
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository to incomming PR
uses: actions/checkout@v4
- name: Set up build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential valgrind
- name: Compile with Makefile
run: make
- name: Set up testing framework
run: |
git clone https://github.com/LeaYeh/42_minishell_tester.git
cp -r 42_minishell_tester $HOME
chmod +x $HOME/42_minishell_tester/tester.sh
- name: Check memory leaks and set up PR failed count
run: |
$HOME/42_minishell_tester/tester.sh vm
env:
GH_BRANCH: "PR_FAILED_COUNT"
- name: Set up main failed count
run: |
git pull origin main
git checkout main
$HOME/42_minishell_tester/tester.sh vm
env:
GH_BRANCH: "MAIN_FAILED_COUNT"
- name: Compare failed count
run: |
echo "PR_FAILED_COUNT: $PR_FAILED_COUNT"
echo "MAIN_FAILED_COUNT: $MAIN_FAILED_COUNT"
if [ $PR_FAILED_COUNT -gt $MAIN_FAILED_COUNT ]; then
echo "PR_FAILED_COUNT is greater than MAIN_FAILED_COUNT"
exit 1
else
echo "PR_FAILED_COUNT is less than or equal to MAIN_FAILED_COUNT"
exit 0
fi
env:
PR_FAILED_COUNT: ${{ env.PR_FAILED_COUNT }}
MAIN_FAILED_COUNT: ${{ env.MAIN_FAILED_COUNT }}