Merge pull request #1684 from arcaneframework/dev/gg-add-basic-memory… #2257
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: Header/Encoding checker | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '**.cc' | |
- '**.h' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '**.cc' | |
- '**.h' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
# Arcane | |
ARCANE_SOURCE_DIR: '/home/runner/work/framework/framework/arcane' | |
jobs: | |
check-headers: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.ARCANE_SOURCE_DIR }} | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Check files | |
shell: bash | |
run: | | |
cd ${{ env.ARCANE_SOURCE_DIR }} | |
MY_COMMIT=$(git rev-parse HEAD) | |
echo "My commit : $MY_COMMIT" | |
PARENT_BRANCH="$(git rev-parse origin/main)" | |
echo "Parent branch : $PARENT_BRANCH" | |
if [[ $MY_COMMIT == $PARENT_BRANCH ]]; then | |
echo "Already on the parent branch, exit" | |
exit 0 | |
fi | |
COMMON_COMMIT=$(git merge-base $PARENT_BRANCH $MY_COMMIT) | |
if [[ $MY_COMMIT == $COMMON_COMMIT ]]; then | |
echo "Already merged branch" | |
FIRST_MERGE_AFTER_MY_BRANCH=$(git rev-list --merges "$MY_COMMIT..$PARENT_BRANCH" | tail -1) | |
echo "First merge after my branch : $FIRST_MERGE_AFTER_MY_BRANCH" | |
COMMON_COMMIT=$(git rev-parse "$FIRST_MERGE_AFTER_MY_BRANCH^") | |
else | |
echo "Not merged branch" | |
fi | |
echo "Common commit : $COMMON_COMMIT" | |
export CC_H_FILES=$(git diff --name-only --no-renames --diff-filter=a "$MY_COMMIT..$COMMON_COMMIT" -- '*.cc' '*.h') | |
echo "::group::Files to check :" | |
echo "$CC_H_FILES" | |
echo "::endgroup::" | |
echo "::notice::In case of error, see the section 'Error details' or the artifact 'Header Check Logs'." | |
chmod u+x ${{ env.ARCANE_SOURCE_DIR }}/.github/scripts/header_check.sh | |
${{ env.ARCANE_SOURCE_DIR }}/.github/scripts/header_check.sh > ${{ env.ARCANE_SOURCE_DIR }}/output.log | |
- name: Error details | |
if: failure() | |
shell: bash | |
run: | | |
cat ${{ env.ARCANE_SOURCE_DIR }}/output.log | |
- name: Upload the logs artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: Header Check Logs | |
path: ${{ env.ARCANE_SOURCE_DIR }}/output.log | |
retention-days: 7 |