mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
[fix] Enable CI for pull_requests (#864)
* rename awesome workflow * added new PR workflow - only cpplint and compilation * simple doc add * rename PR workflow * removed cpplint dependency * try v1 checkout * remove pr specific CI * remove dependency to perform git pull * remove blank line * remove checkout@master and use v1 * remove hyphen * remove misplaced with statement * remove redundant git pull * try git pull from origin for compile check * remove git pull altogehter * use setup-python-v2
This commit is contained in:
parent
0224363803
commit
69f7c9c6e1
@ -1,23 +1,22 @@
|
||||
name: Awesome CI Workflow
|
||||
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
# push:
|
||||
# branches: [ master ]
|
||||
# pull_request:
|
||||
# branches: [ master ]
|
||||
|
||||
jobs:
|
||||
code_format:
|
||||
MainSequence:
|
||||
name: Code Formatter
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1 # v2 is broken for git diff
|
||||
- uses: actions/setup-python@v2
|
||||
- name: requirements
|
||||
run: |
|
||||
sudo apt -qq -y update
|
||||
sudo apt -qq install clang-format
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
submodules: true
|
||||
sudo apt -qq install clang-format
|
||||
- name: Setup Git Specs
|
||||
run: |
|
||||
git config --global user.name github-actions
|
||||
@ -56,18 +55,7 @@ jobs:
|
||||
line2: "IndentWidth: 4, TabWidth: 4, "
|
||||
line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,"
|
||||
line4: "ColumnLimit: 80, AccessModifierOffset: -3 }"
|
||||
- name: Git Push
|
||||
run: git push --force origin HEAD:$GITHUB_REF || true
|
||||
|
||||
update_directory_md:
|
||||
name: Update Directory.md
|
||||
needs: code_format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v1
|
||||
- name: pull latest commit
|
||||
run: git pull
|
||||
|
||||
- name: Update DIRECTORY.md
|
||||
shell: python
|
||||
run: |
|
||||
@ -121,32 +109,14 @@ jobs:
|
||||
git add DIRECTORY.md
|
||||
git commit -am "updating DIRECTORY.md" || true
|
||||
git push --force origin HEAD:$GITHUB_REF || true
|
||||
|
||||
# cpplint:
|
||||
# name: CPPLINT
|
||||
# needs: code_format
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@master
|
||||
# - uses: actions/setup-python@master
|
||||
# - run: pip install cpplint
|
||||
# - run: git pull
|
||||
# - run: cpplint --filter=-legal --recursive .
|
||||
|
||||
cpplint_modified_files:
|
||||
runs-on: ubuntu-latest
|
||||
needs: code_format
|
||||
name: CPPLINT
|
||||
steps:
|
||||
- uses: actions/checkout@master # v2 is broken for git diff
|
||||
- uses: actions/setup-python@master
|
||||
- run: python -m pip install cpplint
|
||||
- run: git remote -v
|
||||
- run: git branch
|
||||
- run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||
- run: git pull
|
||||
- run: git diff --diff-filter=dr --name-only origin/master > git_diff.txt
|
||||
- run: echo "Files changed-- `cat git_diff.txt`"
|
||||
- name: Install CPPLINT
|
||||
run: |
|
||||
python -m pip install cpplint
|
||||
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: cpplint_modified_files
|
||||
shell: python
|
||||
run: |
|
||||
@ -197,8 +167,7 @@ jobs:
|
||||
build:
|
||||
name: Compile checks
|
||||
runs-on: ${{ matrix.os }}
|
||||
# needs: [cpplint, update_directory_md, cpplint_modified_files]
|
||||
needs: [update_directory_md]
|
||||
needs: [MainSequence]
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
@ -206,6 +175,5 @@ jobs:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
submodules: true
|
||||
- run: git pull
|
||||
- run: cmake -B ./build -S .
|
||||
- run: cmake --build build
|
Loading…
Reference in New Issue
Block a user