Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 67 additions & 20 deletions .github/workflows/rpg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,85 @@ jobs:
fi
du -skh --exclude=.git

check_coding_style:
build_and_test:
runs-on: ubuntu-latest
container: ghcr.io/epitech/coding-style-checker:latest
steps:

- name: Checkout GH repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ pkg-config libcriterion-dev \
libxrandr-dev libxcursor-dev libxi-dev libudev-dev \
libgl1-mesa-dev libfreetype-dev libflac-dev libvorbis-dev \
libogg-dev libopenal-dev libx11-dev

- name: Cache SFML/CSFML 3 install
id: cache-csfml
uses: actions/cache@v4
with:
repository: ''
path: ~/csfml-prefix
key: csfml-3.0.0-${{ runner.os }}

- name: Run coding-style
run: check.sh . /tmp
- name: Build SFML 3 + CSFML 3 from source
if: steps.cache-csfml.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch 3.0.0 https://github.com/SFML/SFML.git
cmake -S SFML -B sfml-build -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$HOME/csfml-prefix
cmake --build sfml-build --target install -j $(nproc)
git clone --depth 1 --branch 3.0.0 https://github.com/SFML/CSFML.git
cmake -S CSFML -B csfml-build -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$HOME/csfml-prefix \
-DCMAKE_PREFIX_PATH=$HOME/csfml-prefix
cmake --build csfml-build --target install -j $(nproc)

- name: Create annotation for coding-style errors
- name: Install SFML/CSFML 3 into system prefix
run: |
input=/tmp/coding-style-reports.log
while IFS= read -r -a line; do
fields=($(printf "%s" "$line"|cut -d':' --output-delimiter=' ' -f1-))
echo "::error title=${fields[2]} coding style error,file=${fields[0]},line=${fields[1]}::${fields[3]}"
done < $input
sudo cp -a $HOME/csfml-prefix/include/. /usr/local/include/
sudo cp -a $HOME/csfml-prefix/lib/. /usr/local/lib/
sudo ldconfig

- name: Report banana result
- name: Build
run: make

- name: Run unit tests
run: make tests_run

coding_style:
runs-on: ubuntu-latest
steps:

- name: Checkout GH repository
uses: actions/checkout@v4

- name: Install Banana and a CSFML 3 header tree
run: |
NB_ERROR=$(cat /tmp/coding-style-reports.log | wc -l)
if [ $NB_ERROR -gt 0 ]; then
exit 1
fi
sudo add-apt-repository -y ppa:epitech/ppa
sudo apt-get update
sudo apt-get install -y banana-coding-style-checker cmake g++
git clone --depth 1 --branch 3.0.0 \
https://github.com/SFML/CSFML.git "$HOME/csfml-src"
sudo mkdir -p /usr/local/include
sudo cp -a "$HOME/csfml-src/include/." /usr/local/include/

- name: Code rules (epiclang)
run: |
for f in $(find src -name '*.c'); do \
epiclang -fsyntax-only -I include -I /usr/local/include "$f" 2>&1; \
done | grep '\[Banana\]' | grep -E '^(src|include)/' > banana.log \
|| true
if [ -s banana.log ]; then cat banana.log; exit 1; fi

- name: Repository rules (banana-check-repo)
run: banana-check-repo .

push_to_mirror:
runs-on: ubuntu-latest
needs: check_coding_style
if: github.event_name == 'push'
needs: [coding_style, build_and_test]
if: github.event_name == 'push' && vars.MIRROR_URL != ''
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -65,4 +112,4 @@ jobs:
target_repo_url:
${{ vars.MIRROR_URL }}
ssh_private_key:
${{ secrets.GIT_SSH_PRIVATE_KEY }}
${{ secrets.GIT_SSH_PRIVATE_KEY }}
Loading