mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-06 22:24:12 -05:00
Refactor workflow files (#8355)
* Refactor workflow files * Fix YAMLlint errors
This commit is contained in:
committed by
GitHub
parent
4d2a899ddd
commit
41a708c1c5
1
.github/ISSUE_TEMPLATE/config.yml
vendored
1
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1 +1,2 @@
|
||||
---
|
||||
blank_issues_enabled: false
|
||||
|
||||
1
.github/workflows/.mdlrc
vendored
1
.github/workflows/.mdlrc
vendored
@@ -1 +0,0 @@
|
||||
style '.mdl_style.rb'
|
||||
56
.github/workflows/Handoff.yml
vendored
Normal file
56
.github/workflows/Handoff.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: Handoff
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
jobs:
|
||||
handoff:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
category: ${{ steps.changed-file-extensions.outputs.category }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v36
|
||||
- name: Get extensions of changed files
|
||||
id: changed-file-extensions
|
||||
run: |
|
||||
category=
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
ext="${file##*.}"
|
||||
case $ext in
|
||||
md)
|
||||
category=Markdown;;
|
||||
rb)
|
||||
category=Ruby;;
|
||||
sh)
|
||||
category=Bash;;
|
||||
yml|yaml)
|
||||
category=YAML;;
|
||||
*)
|
||||
echo "Unable to check syntax of $file.";;
|
||||
esac
|
||||
# In order for files such as bin/crew to be recognised
|
||||
[[ "$(file -b $file | cut -d' ' -f1)" == "Ruby" ]] && category=Ruby
|
||||
done
|
||||
echo "category=$category" >> $GITHUB_OUTPUT
|
||||
# Github won't let us do this neatly, see https://github.com/orgs/community/discussions/25246
|
||||
markdown:
|
||||
needs: handoff
|
||||
if: ${{ needs.handoff.outputs.category == 'Markdown' }}
|
||||
uses: ./.github/workflows/Markdown-lint.yml
|
||||
ruby:
|
||||
needs: handoff
|
||||
if: ${{ needs.handoff.outputs.category == 'Ruby' }}
|
||||
uses: ./.github/workflows/Rubocop.yml
|
||||
bash:
|
||||
needs: handoff
|
||||
if: ${{ needs.handoff.outputs.category == 'Bash' }}
|
||||
uses: ./.github/workflows/ShellCheck.yml
|
||||
yaml:
|
||||
needs: handoff
|
||||
if: ${{ needs.handoff.outputs.category == 'YAML' }}
|
||||
uses: ./.github/workflows/YAMLlint.yml
|
||||
69
.github/workflows/Linters.yml
vendored
69
.github/workflows/Linters.yml
vendored
@@ -1,69 +0,0 @@
|
||||
---
|
||||
name: Linters
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install ruby
|
||||
uses: ruby/setup-ruby@v1.150.0
|
||||
with:
|
||||
ruby-version: 3.2.2
|
||||
- name: Install linters
|
||||
run: |
|
||||
gem install mdl yaml-lint
|
||||
sudo apt install shellcheck -y
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
- name: Syntax check
|
||||
run: |
|
||||
ruby=
|
||||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
|
||||
ext="${file##*.}"
|
||||
if ! [[ "$ext" =~ ^(md|rb|sh|yml|yaml)$ ]]; then
|
||||
type="$(file -b "$file" | cut -d' ' -f1)"
|
||||
case $type in
|
||||
Bourne-Again)
|
||||
ext="sh"
|
||||
;;
|
||||
HTML)
|
||||
ext="md"
|
||||
;;
|
||||
Ruby)
|
||||
ext="rb"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $ext in
|
||||
md)
|
||||
mdl -c .mdlrc "$file"
|
||||
;;
|
||||
rb)
|
||||
ruby=true
|
||||
ruby -wcWlevel=2 "$file"
|
||||
;;
|
||||
sh)
|
||||
shellcheck "$file"
|
||||
;;
|
||||
yml|yaml)
|
||||
yaml-lint "$file"
|
||||
;;
|
||||
*)
|
||||
echo "Unable to check syntax of $file."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "ruby=$ruby" >> $GITHUB_ENV
|
||||
- name: Rubocop
|
||||
if: env.ruby
|
||||
uses: satmandu/Octocop@v0.0.3
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-check
|
||||
rubocop_flags: "-c .rubocop.yml"
|
||||
14
.github/workflows/Markdown-lint.yml
vendored
Normal file
14
.github/workflows/Markdown-lint.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: Markdown-lint
|
||||
on: workflow_call
|
||||
jobs:
|
||||
markdown-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Markdown-lint
|
||||
uses: bewuethr/mdl-action@v1
|
||||
with:
|
||||
style-file: .mdl_style.rb
|
||||
16
.github/workflows/Rubocop.yml
vendored
Normal file
16
.github/workflows/Rubocop.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Rubocop
|
||||
on: workflow_call
|
||||
jobs:
|
||||
rubocop:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Rubocop
|
||||
uses: satmandu/Octocop@v0.0.3
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-check
|
||||
rubocop_flags: "-l -c .rubocop.yml"
|
||||
14
.github/workflows/ShellCheck.yml
vendored
Normal file
14
.github/workflows/ShellCheck.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: ShellCheck
|
||||
on: workflow_call
|
||||
jobs:
|
||||
shellcheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: ShellCheck
|
||||
uses: ludeeus/action-shellcheck@master
|
||||
with:
|
||||
ignore_paths: ./tools/*
|
||||
14
.github/workflows/YAMLlint.yml
vendored
Normal file
14
.github/workflows/YAMLlint.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: YAMLLint
|
||||
on: workflow_call
|
||||
jobs:
|
||||
yamllint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: YAMLLint
|
||||
uses: ibiqlik/action-yamllint@v3
|
||||
with:
|
||||
config_file: .yamllint.yml
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
||||
# configuration file. It makes it possible to enable/disable
|
||||
# certain cops (checks) and to alter their behavior if they accept
|
||||
@@ -13,7 +14,7 @@ AllCops:
|
||||
NewCops: enable
|
||||
TargetRubyVersion: 3.1
|
||||
Exclude:
|
||||
- 'lib/docopt.rb'
|
||||
- 'lib/docopt.rb'
|
||||
|
||||
# These cops have been temporarily disabled and should be reenabled asap
|
||||
Security/Eval:
|
||||
|
||||
17
.travis.yml
17
.travis.yml
@@ -1,17 +0,0 @@
|
||||
language: bash
|
||||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- docker pull brunux/chromeos
|
||||
|
||||
script:
|
||||
# Workaround sudo prompting for password by editing existing chronos entry
|
||||
- docker run -it
|
||||
-v $PWD:/travis
|
||||
brunux/chromeos
|
||||
/bin/sh -c "
|
||||
grep chronos /etc/sudoers > /tmp/sudoers.new;
|
||||
sed s/chronos/ALL/ /tmp/sudoers.new > /etc/sudoers;
|
||||
sudo -u chronos bash /travis/install.sh;
|
||||
"
|
||||
6
.yamllint.yml
Normal file
6
.yamllint.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length: disable
|
||||
truthy: disable
|
||||
@@ -1346,7 +1346,7 @@ activity: low
|
||||
---
|
||||
kind: url
|
||||
name: dmd
|
||||
url: https://github.com/dlang/dmd/releases
|
||||
url: https://github.com/dlang/dmd/releases
|
||||
activity: high
|
||||
---
|
||||
kind: url
|
||||
|
||||
Reference in New Issue
Block a user