Skip to content

Commit

Permalink
ci: add some ci settings (#2)
Browse files Browse the repository at this point in the history
* ci: add some ci settings

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* style: apply pre-commit

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add hadolint yaml

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* remove ansible galaxy install from ci

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add sync files settings

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add cancel previous workflows yaml

Signed-off-by: Daisuke Nishimatsu <[email protected]>

* add new line

Signed-off-by: Daisuke Nishimatsu <[email protected]>

Signed-off-by: Daisuke Nishimatsu <[email protected]>
  • Loading branch information
wep21 authored Dec 22, 2022
1 parent 33f84c9 commit d501367
Show file tree
Hide file tree
Showing 24 changed files with 424 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exclude_paths:
- src/

skip_list:
- meta-no-info # We don't publish to Ansible Galaxy.
- package-latest # Since this is a development environment, we allow the latest versions.

warn_list: []
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
open-pull-requests-limit: 1
labels:
- bot
- github-actions
15 changes: 15 additions & 0 deletions .github/sync-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- repository: autowarefoundation/autoware
files:
- source: .github/dependabot.yaml
- source: .github/workflows/cancel-previous-workflows.yaml
- source: .github/workflows/pre-commit.yaml
- source: .github/workflows/pre-commit-optional.yaml
- source: .github/workflows/semantic-pull-request.yaml
- source: .github/workflows/spell-check-differential.yaml
- source: .github/workflows/sync-files.yaml
- source: .markdown-link-check.json
- source: .markdownlint.yaml
- source: .pre-commit-config-optional.yaml
- source: .prettierignore
- source: .prettierrc.yaml
- source: .yamllint.yaml
14 changes: 14 additions & 0 deletions .github/workflows/cancel-previous-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: cancel-previous-workflows

on:
pull_request_target:

jobs:
cancel-previous-workflows:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
workflow_id: all
all_but_latest: true
37 changes: 37 additions & 0 deletions .github/workflows/pre-commit-ansible-autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pre-commit-ansible-autoupdate

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
check-secret:
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}

pre-commit-ansible-autoupdate:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run pre-commit-autoupdate
uses: autowarefoundation/autoware-github-actions/pre-commit-autoupdate@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pre-commit-config: .pre-commit-config-ansible.yaml
pr-labels: |
bot
pre-commit-ansible-autoupdate
pr-branch: pre-commit-ansible-autoupdate
pr-title: "ci(pre-commit-ansible): autoupdate"
pr-commit-message: "ci(pre-commit-ansible): autoupdate"
auto-merge-method: squash
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit-ansible.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit-ansible

on:
pull_request:

jobs:
pre-commit-ansible:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config-ansible.yaml
38 changes: 38 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pre-commit-autoupdate

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
check-secret:
if: ${{ github.event.repository.private }}
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}

pre-commit-autoupdate:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run pre-commit-autoupdate
uses: autowarefoundation/autoware-github-actions/pre-commit-autoupdate@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pre-commit-config: .pre-commit-config.yaml
pr-labels: |
bot
pre-commit-autoupdate
pr-branch: pre-commit-autoupdate
pr-title: "ci(pre-commit): autoupdate"
pr-commit-message: "ci(pre-commit): autoupdate"
auto-merge-method: squash
37 changes: 37 additions & 0 deletions .github/workflows/pre-commit-optional-autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pre-commit-optional-autoupdate

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
check-secret:
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}

pre-commit-optional-autoupdate:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run pre-commit-autoupdate
uses: autowarefoundation/autoware-github-actions/pre-commit-autoupdate@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pre-commit-config: .pre-commit-config-optional.yaml
pr-labels: |
bot
pre-commit-optional-autoupdate
pr-branch: pre-commit-optional-autoupdate
pr-title: "ci(pre-commit-optional): autoupdate"
pr-commit-message: "ci(pre-commit-optional): autoupdate"
auto-merge-method: squash
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit-optional.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit-optional

on:
pull_request:

jobs:
pre-commit-optional:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config-optional.yaml
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: pre-commit

on:
pull_request:

jobs:
pre-commit:
if: ${{ github.event.repository.private }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ steps.generate-token.outputs.token }}

- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config.yaml
token: ${{ steps.generate-token.outputs.token }}
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: semantic-pull-request

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
semantic-pull-request:
uses: autowarefoundation/autoware-github-actions/.github/workflows/semantic-pull-request.yaml@v1
16 changes: 16 additions & 0 deletions .github/workflows/spell-check-differential.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: spell-check-differential

on:
pull_request:

jobs:
spell-check-differential:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Run spell-check
uses: autowarefoundation/autoware-github-actions/spell-check@v1
with:
cspell-json-url: https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/.cspell.json
33 changes: 33 additions & 0 deletions .github/workflows/sync-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: sync-files

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
check-secret:
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}

sync-files:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run sync-files
uses: autowarefoundation/autoware-github-actions/sync-files@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pr-labels: |
bot
sync-files
auto-merge-method: squash
3 changes: 3 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignored:
- DL3008
- SC2016
16 changes: 16 additions & 0 deletions .markdown-link-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"aliveStatusCodes": [200, 206, 403],
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^http://127\\.0\\.0\\.1"
},
{
"pattern": "^https://github.com/.*/discussions/new"
}
],
"retryOn429": true,
"retryCount": 10
}
11 changes: 11 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules.
default: true
MD013: false
MD024:
siblings_only: true
MD029:
style: ordered
MD033: false
MD041: false
MD046: false
MD049: false
5 changes: 5 additions & 0 deletions .pre-commit-config-ansible.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/ansible/ansible-lint.git
rev: v6.8.6
hooks:
- id: ansible-lint
6 changes: 6 additions & 0 deletions .pre-commit-config-optional.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/tcort/markdown-link-check
rev: v3.10.3
hooks:
- id: markdown-link-check
args: [--config=.markdown-link-check.json]
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ci:
autofix_commit_msg: "style(pre-commit): autofix"
autoupdate_commit_msg: "ci(pre-commit): autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.31.1
hooks:
- id: markdownlint
args: [-c, .markdownlint.yaml, --fix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier

- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
- id: shellcheck

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.5.1-1
hooks:
- id: shfmt
args: [-w, -s, -i=4]

- repo: https://github.com/AleksaC/hadolint-py
rev: v2.10.0
hooks:
- id: hadolint

exclude: .svg
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.param.yaml
*.rviz
Loading

0 comments on commit d501367

Please sign in to comment.