diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 0000000..eddbbf2 --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,29 @@ +name: Makefile + +on: + push: + +jobs: + check-makefile: + name: Makefile + runs-on: ubuntu-latest + if: ${{ github.repository != 'sdevsantiago/42_project_template' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Prerequisites + run: sudo apt install build-essential + + - name: Show Make Version + run: make --version + + - name: Run Makefile + run: make > makefile-report.txt + + - name: Upload Makefile report + uses: actions/upload-artifact@v4 + with: + name: makefile-report + path: makefile-report.txt + diff --git a/.github/workflows/norminette.yml b/.github/workflows/norminette.yml new file mode 100644 index 0000000..843604c --- /dev/null +++ b/.github/workflows/norminette.yml @@ -0,0 +1,33 @@ +name: Norminette + +on: + push: + +jobs: + check-norminette: + name: Norminette + runs-on: ubuntu-latest + if: ${{ github.repository != 'sdevsantiago/42_project_template' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Norminette + run: pip install --upgrade norminette + + - name: Show Version + run: norminette --version + + - name: Run Norminette + run: norminette -R CheckForbiddenSourceHeader -R CheckDefine -R CheckLine -R CheckVariableName -R CheckFunctionName --use-gitignore > norminette-report.txt + + - name: Upload Norminette report + uses: actions/upload-artifact@v4 + with: + name: norminette-report + path: norminette-report.txt diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..852da54 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,50 @@ +name: Update 42 repo + +on: + push: + +permissions: + contents: write + pages: write + id-token: write + +jobs: + update: + name: Update 42 repo + runs-on: ubuntu-latest + if: ${{ github.repository != 'sdevsantiago/42_project_template' }} + steps: + - name: Get repo name + id: repo_name + run: echo "repo_name=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f2)" >> $GITHUB_OUTPUT + + - name: Git config + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Checkout + uses: actions/checkout@v5 + with: + path: ${{ steps.repo_name.outputs.repo_name }} + + - name: Checkout 42 + uses: actions/checkout@v5 + with: + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + repository: sdevsantiago/42 + path: 42 + submodules: true + + - name: Sync and commit + run: | + cd 42 + git submodule update --remote ${{ steps.repo_name.outputs.repo_name }} + if ! git diff --quiet; then + git commit -am "[${{ steps.repo_name.outputs.repo_name }}] $(cd ${{ steps.repo_name.outputs.repo_name }} && git log -n 1 --format=%B)" + git push + else + echo "Submodule already up to date." + fi + env: + SYNC_PAT: ${{ secrets.SYNC_PAT }}