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
|
name: Awesome CI Workflow
|
||||||
|
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
# push:
|
# push:
|
||||||
# branches: [ master ]
|
# branches: [ master ]
|
||||||
# pull_request:
|
# pull_request:
|
||||||
# branches: [ master ]
|
# branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
code_format:
|
MainSequence:
|
||||||
name: Code Formatter
|
name: Code Formatter
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v1 # v2 is broken for git diff
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
- name: requirements
|
- name: requirements
|
||||||
run: |
|
run: |
|
||||||
sudo apt -qq -y update
|
sudo apt -qq -y update
|
||||||
sudo apt -qq install clang-format
|
sudo apt -qq install clang-format
|
||||||
- uses: actions/checkout@master
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Setup Git Specs
|
- name: Setup Git Specs
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name github-actions
|
git config --global user.name github-actions
|
||||||
@ -56,18 +55,7 @@ jobs:
|
|||||||
line2: "IndentWidth: 4, TabWidth: 4, "
|
line2: "IndentWidth: 4, TabWidth: 4, "
|
||||||
line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,"
|
line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,"
|
||||||
line4: "ColumnLimit: 80, AccessModifierOffset: -3 }"
|
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
|
- name: Update DIRECTORY.md
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
@ -121,32 +109,14 @@ jobs:
|
|||||||
git add DIRECTORY.md
|
git add DIRECTORY.md
|
||||||
git commit -am "updating DIRECTORY.md" || true
|
git commit -am "updating DIRECTORY.md" || true
|
||||||
git push --force origin HEAD:$GITHUB_REF || true
|
git push --force origin HEAD:$GITHUB_REF || true
|
||||||
|
- name: Install CPPLINT
|
||||||
# cpplint:
|
run: |
|
||||||
# name: CPPLINT
|
python -m pip install cpplint
|
||||||
# needs: code_format
|
git remote -v
|
||||||
# runs-on: ubuntu-latest
|
git branch
|
||||||
# steps:
|
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||||
# - uses: actions/checkout@master
|
git diff --diff-filter=dr --name-only origin/master > git_diff.txt
|
||||||
# - uses: actions/setup-python@master
|
echo "Files changed-- `cat git_diff.txt`"
|
||||||
# - 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: cpplint_modified_files
|
- name: cpplint_modified_files
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
@ -197,8 +167,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Compile checks
|
name: Compile checks
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
# needs: [cpplint, update_directory_md, cpplint_modified_files]
|
needs: [MainSequence]
|
||||||
needs: [update_directory_md]
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
@ -206,6 +175,5 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- run: git pull
|
|
||||||
- run: cmake -B ./build -S .
|
- run: cmake -B ./build -S .
|
||||||
- run: cmake --build build
|
- run: cmake --build build
|
Loading…
Reference in New Issue
Block a user