ft_libft CI test #120
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: CI | |
run-name: ft_libft CI test | |
on: | |
push: | |
branches: [main] | |
paths: | |
- '**.c' | |
- '**.h' | |
- Makefile | |
- '**.mk' | |
pull_request: | |
types: [opened] | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
is_called: | |
description: "Is called by another actions" | |
default: false | |
type: boolean | |
jobs: | |
info: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "💬 github" | |
run: |+ | |
echo "Who launched: ${{ github.actor }}" | |
echo "On branch: ${{ github.ref_name }}" | |
echo "Commit sha: ${{ github.sha }}" | |
echo "Trigger event name ${{ github.event_name }}" | |
- name: "💬 Bin utils" | |
run: |+ | |
make --version && echo | |
ar --version && echo | |
gcc --verbose && echo | |
python3 --version | |
build: | |
strategy: | |
max-parallel: 5 | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: ☁️ Retrieve repo | |
uses: actions/checkout@v3 | |
with: | |
repository: "Pixailz/ft_libft" | |
submodules: recursive | |
- name: ☁️ Update submodule | |
if: ${{ inputs.is_called }} | |
run: git submodule update --remote --recursive | |
- name: 🔧 Build up libft.a (${{ matrix.os }}) | |
run: |+ | |
DISABLE_HELPER=1 make fclean | |
DISABLE_HELPER=1 make | |
DISABLE_HELPER=1 make re | |
DISABLE_HELPER=1 make | |
- name: 🔧 Call helper | |
run: make helper | |
test: | |
strategy: | |
max-parallel: 5 | |
matrix: | |
test_src: [ | |
"ato.c", | |
"check/is_str.c", | |
"get_next_line.c", | |
"hton.c", | |
"htoi4.c", | |
"int4.c", | |
"ipv4.c", | |
"isexec.c", | |
"ntop.c", | |
"parsing.c", | |
"print_nb_base.c", | |
"print.c", | |
"random.c", | |
"tmpfile.c", | |
"hashtable.c", | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: ☁️ Retrieve repo | |
uses: actions/checkout@v3 | |
with: | |
repository: "Pixailz/ft_libft" | |
submodules: recursive | |
- name: ☁️ Update submodule | |
if: ${{ inputs.is_called }} | |
run: git submodule update --remote --recursive | |
- name: ☁️ Check if mlx needed | |
id: mlx | |
run: |+ | |
if grep 'USE_MINI_LIBX\s*:=\s*1' mk/config.mk >& 2>/dev/null; then | |
echo "is_mlx_needed=1" >> "$GITHUB_OUTPUT" | |
else | |
echo "is_mlx_needed=0" >> "$GITHUB_OUTPUT" | |
fi | |
- name: 🔧 Install mlx dependencies | |
if: ${{ steps.mlx.outputs.is_mlx_needed }} == '1' | |
run: sudo apt-get install xorg libxext-dev libbsd-dev | |
- name: 🔧 Launch, with sudo, ${{ matrix.test_src }} | |
if: contains(fromJson('["htoi4.c", "i4toh.c"]'), matrix.test_src) | |
run: sudo make CI_TARGET=${{ matrix.test_src }} ci-run | |
- name: 🔧 Launch ${{ matrix.test_src }} | |
if: ${{ !contains(fromJson('["htoi4.c", "i4toh.c"]'), matrix.test_src) }} | |
run: make CI_TARGET=${{ matrix.test_src }} ci-run | |
norminette: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ☁️ Retrieve repo | |
uses: actions/checkout@v3 | |
with: | |
repository: "Pixailz/ft_libft" | |
submodules: recursive | |
- name: ☁️ Update submodule | |
if: ${{ inputs.is_called }} | |
run: git submodule update --remote --recursive | |
- name: ☁️ Setup python3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: ☁️ Installing Norminette | |
run: pip install norminette | |
- name: 💬 Run | |
run: python3 -m norminette || true | |
do_other: | |
needs: [build, test, norminette] | |
if: ${{ ! inputs.is_called }} | |
uses: ./.github/workflows/CD-other.yml | |
secrets: inherit | |
do_release: | |
needs: [do_other] | |
if: ${{ ! inputs.is_called }} | |
uses: ./.github/workflows/CD-release.yml | |
secrets: inherit |