Skip to content

Commit

Permalink
hotfix: support cmake 3.20, add workflow modify checker. (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-matsuzawa authored Apr 6, 2021
1 parent 063b76b commit 5ff66f5
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 36 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/check_pre-merge_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ jobs:
- name: cmake_version
run: cmake --version
- name: cmake_generage
run: cmake -S . -B build -G "${{ matrix.generator }}"
- name: cmake_configure
run: cmake -DENABLE_SHARED=${{ matrix.shared }} --build build
run: cmake -S . -B build -G "${{ matrix.generator }}" -DENABLE_SHARED=${{ matrix.shared }}
- name: cmake_build
run: cmake --build build --config Release --parallel 4
- name: ctest
Expand All @@ -40,16 +38,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15, macos-11.0]
os: [macos-10.15]
# os: [macos-10.15, macos-11.0]

steps:
- uses: actions/checkout@v2
- name: cmake_version
run: cmake --version
- name: cmake_generage-macos
run: cmake -S . -B build -G "Unix Makefiles"
- name: cmake_configure-enable
run: cmake -DENABLE_SHARED=on -DENABLE_ELEMENTS=on --build build
run: cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=on -DENABLE_ELEMENTS=on
- name: cmake_build
run: cmake --build build --config Release --parallel 4
- name: ctest
Expand Down Expand Up @@ -80,9 +77,7 @@ jobs:
cmake --version
gcc --version
- name: cmake_configure
run: |
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DTARGET_RPATH=./build/Release --build build
run: cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DTARGET_RPATH=./build/Release
- name: cmake-build
run: cmake --build build --config Release --parallel 4
- name: lint_check
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/check_pre-merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ jobs:
- name: cmake_version
run: cmake --version
- name: cmake_generage
run: cmake -S . -B build -G "${{ matrix.generator }}"
- name: cmake_configure
run: cmake -DENABLE_SHARED=${{ matrix.shared }} --build build
run: cmake -S . -B build -G "${{ matrix.generator }}" -DENABLE_SHARED=${{ matrix.shared }}
- name: cmake_build
run: cmake --build build --config Release --parallel 4
- name: ctest
Expand All @@ -48,9 +46,7 @@ jobs:
- name: cmake_version
run: cmake --version
- name: cmake_generage-macos
run: cmake -S . -B build -G "Unix Makefiles"
- name: cmake_configure-enable
run: cmake -DENABLE_SHARED=on -DENABLE_ELEMENTS=on --build build
run: cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=on -DENABLE_ELEMENTS=on
- name: cmake_build
run: cmake --build build --config Release --parallel 4
- name: ctest
Expand Down Expand Up @@ -81,9 +77,7 @@ jobs:
cmake --version
gcc --version
- name: cmake_configure
run: |
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DTARGET_RPATH=./build/Release --build build
run: cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DTARGET_RPATH=./build/Release
- name: cmake-build
run: cmake --build build --config Release --parallel 4
- name: lint_check
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/check_pre-merge_sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ jobs:
- name: cmake_version
run: cmake --version
- name: cmake_generage
run: cmake -S . -B build -G "${{ matrix.generator }}"
run: cmake -S . -B build -G "${{ matrix.generator }}" -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_TESTS=on
- name: cmake_build
run: |
cmake -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_TESTS=on --build build
cmake --build build --config Release --parallel 4
run: cmake --build build --config Release --parallel 4
- name: ctest
run: |
cd build
Expand All @@ -48,9 +46,7 @@ jobs:
- name: cmake_version
run: cmake --version
- name: cmake_generage-macos
run: |
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=on --build build
run: cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=on
- name: cmake_build
run: cmake --build build --config Release --parallel 4
- name: ctest
Expand Down Expand Up @@ -81,8 +77,7 @@ jobs:
- name: cmake-build
run: |
cmake --version
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=${{ matrix.elements }} -DTARGET_RPATH=./build/Debug --build build
cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=${{ matrix.shared }} -DENABLE_ELEMENTS=${{ matrix.elements }} -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=${{ matrix.elements }} -DTARGET_RPATH=./build/Debug
cmake --build build --config Debug --parallel 4
- name: lint_check
run: ./tools/lint_quiet.sh
Expand Down Expand Up @@ -127,8 +122,7 @@ jobs:
- name: cmake-build
run: |
cmake --version
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=Debug -DTARGET_RPATH=./build/Debug --build build
cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=Debug -DTARGET_RPATH=./build/Debug
cmake --build build --config Debug --parallel 4
- name: valgrind
run: |
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/workflow_modify_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: workflow modify checker

# This file is is check the workflow modification on the pull request.
# If this workflow is set to work, it will forcibly cancel all workflows when any workflow changes are made.
# To get this workflow working, configure the following settings:
# 1. Push this file to the default branch.
# 2. Add issue label 'update CI'.
# 3. Set github secrets 'CANCEL_WORKFLOW_TOKEN'. (Token can cancel the repository workflow.)
#
# If you want to modify any of the workflow files, set the Pull Request label to 'update CI'.
# Then re-run the canceled workflow.

on:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
paths:
'.github/workflows/**'

jobs:
check-actions:
name: check actions
runs-on: ubuntu-20.04

steps:
- name: check secret
id: check_secret
run: |
if [[ -n '${{secrets.CANCEL_WORKFLOW_TOKEN}}' ]]; then
echo "::set-output name=exist_secret::true"
else
echo "::set-output name=exist_secret::false"
fi
- if: contains(github.event.pull_request.labels.*.name, 'update CI') != true && steps.check_secret.outputs.exist_secret == 'true'
name: wait 20 sec
run: sleep 20
- if: contains(github.event.pull_request.labels.*.name, 'update CI') != true && steps.check_secret.outputs.exist_secret == 'true'
name: cancel workflows
id: cancel_workflow
uses: actions/github-script@v3
with:
github-token: ${{ secrets.CANCEL_WORKFLOW_TOKEN }}
script: |
const creator = context.payload.sender.login
const opts1 = github.actions.listWorkflowRunsForRepo.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
event: 'pull_request',
status: 'queued'
})
const queuedWorkflows = await github.paginate(opts1)
const opts2 = github.actions.listWorkflowRunsForRepo.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
event: 'pull_request',
status: 'in_progress'
})
const inProgressWorkflows = await github.paginate(opts2)
const workflows = queuedWorkflows.concat(inProgressWorkflows)
//console.log(workflows);
for (const workflow of workflows) {
if (workflow.run_number == context.runNumber) continue
await github.actions.cancelWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: workflow.id
})
console.log(`cancel: ${workflow.name} (${workflow.id}),`,
`path:${workflow.head_repository.full_name}/tree/${workflow.head_branch}`);
}
throw new Error('Change workflow file. please set label "update CI".')
- if: success()
run: echo "enabled editing workflow."
4 changes: 1 addition & 3 deletions tools/simple_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ if exist "simple_build.bat" (
cd ..
)

CALL cmake -S . -B build -G "Visual Studio 16 2019"

CALL cmake -DENABLE_SHARED=on -DENABLE_TESTS=on -DENABLE_ELEMENTS=on -DCMAKE_BUILD_TYPE=Release --build build
CALL cmake -S . -B build -G "Visual Studio 16 2019" -DENABLE_SHARED=on -DENABLE_TESTS=on -DENABLE_ELEMENTS=on -DCMAKE_BUILD_TYPE=Release

CALL cmake --build build --config Release --parallel 4
4 changes: 1 addition & 3 deletions tools/simple_build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh
cd `git rev-parse --show-toplevel`

cmake -S . -B build -G "Unix Makefiles"

cmake -DENABLE_SHARED=off -DENABLE_TESTS=on -DENABLE_ELEMENTS=on -DCMAKE_BUILD_TYPE=Release -DTARGET_RPATH=./build/Release --build build
cmake -S . -B build -G "Unix Makefiles" -DENABLE_SHARED=off -DENABLE_TESTS=on -DENABLE_ELEMENTS=on -DCMAKE_BUILD_TYPE=Release -DTARGET_RPATH=./build/Release

cmake --build build --config Release --parallel 4

0 comments on commit 5ff66f5

Please sign in to comment.