🔀Merge pull request #80 from Marius-P1/79-make-the-4515-bonus #1
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
# This file is used to check the coding style, compile the | |
# repository, run the tests on the repository and push the | |
# repository to the Epitech repository. | |
# For the name a true evidence of the power of the Chocolatine. | |
name: A Chocolatine is always good | |
# Run on all pushes and pull requests unless | |
# the branch name starts with "ga-ignore-". | |
on: | |
push: | |
branches-ignore: | |
- 'ga-ignore-**' | |
pull_request: | |
branches-ignore: | |
- 'ga-ignore-**' | |
# Define the environment variables. | |
env: | |
# The list of executables to check. | |
# The executables must be separated by a comma. | |
EXECUTABLES: nanotekspice | |
# The URL of the mirror repository. | |
MIRROR_URL: git@github.com:EpitechPromo2027/B-OOP-400-NAN-4-1-tekspice-marius.pain.git | |
# Define the jobs to run. | |
# Each job is a set of steps that will be run when you push or | |
# open a pull request. | |
# If a job fails, the next jobs will not be run. | |
jobs: | |
# Make a compilation check on the repository | |
# and check if the executable exists. | |
check_program_compilation: | |
runs-on: ubuntu-latest | |
container: | |
image: epitechcontent/epitest-docker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check program compilation | |
run: make | |
timeout-minutes: 2 | |
- name: Stop if compilation failed | |
if: ${{ failure() }} | |
run: exit 1 | |
- name: Clean | |
run: make clean | |
- name: Check if executable exists | |
run: | | |
IFS=',' | |
for exec_path in $EXECUTABLES; do | |
if [ ! -x "$exec_path" ]; then | |
echo "::error::Executable not found." | |
exit 1 | |
else | |
echo "::notice::Executable found: $exec_path" | |
fi | |
done | |
# Run the tests on the repository with the Criterion library. | |
# The tests must be in the tests/ directory and on SRC_TESTS in | |
# the Makefile. | |
# The tests will be run in the Epitest Docker container. | |
run_tests: | |
runs-on: ubuntu-latest | |
needs: check_program_compilation | |
container: | |
image: epitechcontent/epitest-docker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run tests | |
run: make tests_run | |
timeout-minutes: 2 | |
- name: Test execution | |
run: | | |
if [ -f unit_tests ]; then | |
echo "::notice::Successful test execution." | |
else | |
echo "::warning::Test failed or not available." | |
fi | |
# Push the repository to the Epitech repository only on push. | |
# The push will be done using the SSH key stored in the | |
# GIT_SSH_PRIVATE_KEY secret. | |
push_to_mirror: | |
runs-on: ubuntu-latest | |
needs: check_program_compilation | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Push to mirror | |
uses: pixta-dev/repository-mirroring-action@v1.1.1 | |
with: | |
target_repo_url: ${{ env.MIRROR_URL }} | |
ssh_private_key: ${{ secrets.GIT_SSH_PRIVATE_KEY }} | |
- name: Push successful | |
if: success() | |
run: echo "::notice::Successful mirroring process." |