Skip to content

Commit

Permalink
feat: various improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Panquesito7 committed Dec 16, 2022
1 parent 3689e35 commit 949ed06
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions .github/workflows/awesome_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
name: Code Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # v2 is broken for git diff
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: requirements
run: |
sudo apt-get -qq update
Expand All @@ -20,29 +20,13 @@ jobs:
run: |
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout HEAD:$GITHUB_REF
git pull || true # Always fetch changes before making any changes
- name: Filename Formatter
run: |
IFS=$'\n'
for fname in `find . -type f -name '*.cpp' -o -name '*.cc' -o -name '*.h'`
do
echo "${fname}"
new_fname=`echo ${fname} | tr ' ' '_'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr '-' '_'`
echo " ${new_fname}"
new_fname=${new_fname/.cc/.cpp}
echo " ${new_fname}"
if [ ${fname} != ${new_fname} ]
then
echo " ${fname} --> ${new_fname}"
git "mv" "${fname}" ${new_fname}
fi
done
git commit -am "formatting filenames ${GITHUB_SHA::8}" || true
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/filename_formatter.sh
./filename_formatter.sh . .cpp,.hpp
- name: Update DIRECTORY.md
run: |
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/build_directory_md.py
Expand All @@ -52,7 +36,6 @@ jobs:
run: |
git remote -v
git branch
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git diff --diff-filter=dr --name-only origin/master > git_diff.txt
echo "Files changed-- `cat git_diff.txt`"
- name: Configure for static lint checks
Expand All @@ -78,10 +61,10 @@ jobs:
if not cpp_files:
sys.exit(0)
subprocess.run(["clang-tidy-10", "--fix", "-p=build", "--extra-arg=-std=c++11", *cpp_files, "--"],
subprocess.run(["clang-tidy", "--fix", "-p=build", "--extra-arg=-std=c++11", *cpp_files, "--"],
check=True, text=True, stderr=subprocess.STDOUT)
subprocess.run(["clang-format-10", "-i", "-style=file", *cpp_files],
subprocess.run(["clang-format", "-i", "-style=file", *cpp_files],
check=True, text=True, stderr=subprocess.STDOUT)
upper_files = [file for file in cpp_files if file != file.lower()]
Expand All @@ -105,8 +88,8 @@ jobs:
- name: Commit and push changes
run: |
git diff DIRECTORY.md
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
git push --force origin HEAD:$GITHUB_REF || true
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
git push origin HEAD:$GITHUB_REF || true
build:
name: Compile checks
Expand All @@ -116,7 +99,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
submodules: true
- run: cmake -B ./build -S .
Expand Down

0 comments on commit 949ed06

Please sign in to comment.