mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
GitHub Action: Compile modified files with g++ (#677)
* WIP: g++ backtracking/n_queens.cpp DO NOT MERGE. * g++ **/.py * g++ **/.cpp * g++ **/*.cpp * Compile modified files with g++ * Update cpplint_modified_files.yml * Compile modified files with g++
This commit is contained in:
parent
8b237946ba
commit
b64e8fb2e1
12
.github/workflows/cpplint_modified_files.yml
vendored
12
.github/workflows/cpplint_modified_files.yml
vendored
@ -5,7 +5,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v1 # Upgrade shell: python to Python 3.8
|
||||||
|
- run: sudo update-alternatives --install /usr/bin/python python ${pythonLocation}/bin/python3.8 10
|
||||||
- run: python -m pip install cpplint
|
- run: python -m pip install cpplint
|
||||||
- run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
- run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||||
- run: git diff origin/master --name-only > git_diff.txt
|
- run: git diff origin/master --name-only > git_diff.txt
|
||||||
@ -16,7 +17,7 @@ jobs:
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
print("Python {}.{}.{}".format(*sys.version_info)) # legacy Python :-(
|
print("Python {}.{}.{}".format(*sys.version_info)) # Python 3.8.0
|
||||||
with open("git_diff.txt") as in_file:
|
with open("git_diff.txt") as in_file:
|
||||||
modified_files = sorted(in_file.read().splitlines())
|
modified_files = sorted(in_file.read().splitlines())
|
||||||
print("{} files were modified.".format(len(modified_files)))
|
print("{} files were modified.".format(len(modified_files)))
|
||||||
@ -28,7 +29,12 @@ jobs:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print("cpplint:")
|
print("cpplint:")
|
||||||
print(subprocess.check_output(["cpplint", "--filter=-legal/copyright"] + cpp_files).decode("utf-8"))
|
subprocess.run(["cpplint", "--filter=-legal/copyright"] + cpp_files, check=True, text=True)
|
||||||
|
|
||||||
|
print("g++:")
|
||||||
|
# compile_exts = tuple(".c .c++ .cc .cpp .cu .cxx".split())
|
||||||
|
# compile_files = [file for file in cpp_files if file.lower().endswith(compile_exts)]
|
||||||
|
subprocess.run(["g++"] + cpp_files, check=True, text=True)
|
||||||
|
|
||||||
upper_files = [file for file in cpp_files if file != file.lower()]
|
upper_files = [file for file in cpp_files if file != file.lower()]
|
||||||
if upper_files:
|
if upper_files:
|
||||||
|
Loading…
Reference in New Issue
Block a user