Skip to content

Commit

Permalink
[Feat] : add Scripts and github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterLaplace committed Oct 13, 2023
1 parent 19fed98 commit 3922adb
Show file tree
Hide file tree
Showing 16 changed files with 638 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Report a bug
description: Report a bug
title: '[Bug]: '
labels:
- bug
body:
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Tell us what happened
validations:
required: true
- type: textarea
id: what-should-happened
attributes:
label: 'What should have happened?'
validations:
required: true
- type: textarea
id: log
attributes:
label: LOG
description: If you have log, please send it to us!
- type: checkboxes
attributes:
label: I read the Code Of Conduct
options:
- label: I read the Code Of Conduct and I comply to it
required: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Feature request
description: Suggest an idea for this project
title: '[Feature]: '
assignees:
- {{ github.actor }}
labels:
- enhancement
projects:
- '1044'
body:
- type: input
id: featureName
attributes:
label: Feature name
validations:
required: true
- type: textarea
id: featureContent
attributes:
label: Explain the feature
description: Tell us what we should add
validations:
required: true
- type: checkboxes
attributes:
label: I read the Code Of Conduct
options:
- label: I read the Code Of Conduct and I comply to it
required: true
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: I have a question
description: Ask you question, we will answer in documentation () and below your question
title: '[Question]: '
labels:
- enhancement
body:
- type: input
id: questionAbout
attributes:
label: What is your question is about ?
validations:
required: true
- type: textarea
id: questionContent
attributes:
label: Ask your question here
validations:
required: true
- type: checkboxes
attributes:
label: I read the Code Of Conduct
options:
- label: I read the Code Of Conduct and I comply to it
required: true
28 changes: 28 additions & 0 deletions .github/workflows/build_laplace_libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Laplace Libs CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
if: always()

steps:
- name: Checkout
uses: actions/checkout@v3

- name: make lib
run: |
make lib
exit $(($? != 0))
- name: SonarCloud Scan for C and C++
uses: SonarSource/[email protected]

- name: Check if build succeeded
run: exit $(($? != 0))
6 changes: 3 additions & 3 deletions .github/workflows/commit_norm_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
- name: Commit Name Checker
run: |
commit_msg=$(git log --format=%B -n 1 ${{ github.sha }})
keyword_regex="^\[[A-Z][@_A-Za-z,/| ]+\] : "
echo "Commit message: $commit_msg"
keyword_regex="^([a-z]+\([A-Za-z_.]+\)|^[a-z]+): "
if [[ ! $commit_msg =~ $keyword_regex ]]; then
if [[ $commit_msg =~ ^Merge\ .* ]]; then
echo "Skipping merge commit"
else
echo "Commit message does not match expected format. Please use the following format: \"[Keyword@file] : comment\""
echo $commit_msg
echo "Commit message does not match expected format. Please use the following format:\"keyword(scope): comment\""
exit 1
fi
fi
25 changes: 25 additions & 0 deletions .github/workflows/cpp_norm_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: C++ Norm Checker

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up C++ environment
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Check C++ norm by Laplace Linter
run: |
./Scripts/norm_checker.py
70 changes: 70 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Create Release

on:
pull_request:
branches:
- main
types:
- closed

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_BOT_ACC_EMAIL: [email protected]
GH_BOT_ACC_NAME: github-actions[bot]

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check if PR is merged to main
id: pr-check
run: echo "::set-output name=merged::$(jq -r '.pull_request.merged' $GITHUB_EVENT_PATH)"

- name: Install GitHub CLI
run: |
sudo apt update
sudo apt install gh
- name: Set up Git
run: |
git config --local user.email $GH_BOT_ACC_EMAIL
git config --local user.name $GH_BOT_ACC_NAME
- name: Authenticate GitHub CLI
run: gh auth login --with-token <<<"${GITHUB_TOKEN}"

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Increment Version
if: steps.pr-check.outputs.merged == 'true'
run: |
# Read the current version from the VERSION file
current_version=$(cat VERSION)
# Increment the version (you can use any logic you prefer)
new_version=$(python3 increment_version.py $current_version)
# Update the VERSION file with the new version
echo "$new_version" > VERSION
# Commit and push the updated VERSION file
git add VERSION
git commit -m "chore(VERSION): bump version to $new_version"
git push origin main
- name: Create Tag and Release
if: success() && steps.pr-check.outputs.merged == 'true'
run: |
# Create a new tag with the version
git tag -a v$new_version -m "Engine-3D v$new_version"
git push origin v$new_version
# Create a new release
gh release create v$new_version
30 changes: 30 additions & 0 deletions .github/workflows/run_test_engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Engine testing

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
testing:
runs-on: ubuntu-latest

steps:
- name: Install CMake
run: sudo apt-get install -y cmake build-essential

- name: Checkout
uses: actions/checkout@v3

- name: Install CSFML
run: ./Scripts/install_csfml.sh

- name: Install Criterion
run: sudo apt-get install libcriterion-dev

- name: Build engine
run: make build_tests

- name: Testing engine
run: make run_tests
48 changes: 48 additions & 0 deletions .github/workflows/update_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
workflow_run:
workflows: ["Publish Release"]
types:
- completed

env:
GH_PAT: ${{ secrets.GITHUB_TOKEN }}
GH_BOT_ACC_EMAIL: [email protected]
GH_BOT_ACC_NAME: github-actions[bot]

jobs:
readme-update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Git
run: |
git config --local user.email $GH_BOT_ACC_EMAIL
git config --local user.name $GH_BOT_ACC_NAME
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install requirements
run: pip install -r requirements.txt

- name: Get Latest Release Date
id: latest_release_date
run: |
python3 Scripts/get_latest_release_date.py > latest_release_date.txt
echo "::set-output name=release_date::$(cat latest_release_date.txt)"
- name: Update README.md
run: |
release_date=$(cat latest_release_date.txt)
sed -i "s/- Release Date: \*\*([JFMASOND][a-z]+ \d+, \d+)\*\*/- Release Date: $release_date/" README.md
- name: Commit and Push Changes
run: |
git add README.md
git commit -m "chore(README): update README.md with latest release date (bot)"
git push
Loading

0 comments on commit 3922adb

Please sign in to comment.