chore(pre-commit): use google/yamlfmt
Some checks failed
submodules sync / sync (push) Successful in 35s
build / build (push) Failing after 58s
build / trigger-build-image (push) Has been skipped

This commit is contained in:
张泊明518370910136 2024-10-19 06:57:36 -04:00
parent 441410ae25
commit defd6072e1
GPG Key ID: D47306D7062CDA9D
4 changed files with 145 additions and 151 deletions

View File

@ -1,61 +1,59 @@
---
name: build name: build
on: on:
- push - push
- pull_request - pull_request
jobs: jobs:
build: build:
container: container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest
volumes: volumes:
- /home/actions/.ssh:/root/.ssh - /home/actions/.ssh:/root/.ssh
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs uses: https://gitea.com/BoYanZh/checkout@focs
- name: Display Go version - name: Display Go version
run: go version run: go version
- name: Prepare - name: Prepare
run: | run: |
go env -w GO111MODULE=on go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct go env -w GOPROXY=https://goproxy.io,direct
chown -R root:root /root/.ssh chown -R root:root /root/.ssh
# - name: Setup Joint-Teapot # - name: Setup Joint-Teapot
# run: | # run: |
# pip install git+https://ghp.ci/https://github.com/BoYanZh/Joint-Teapot # pip install git+https://ghp.ci/https://github.com/BoYanZh/Joint-Teapot
- name: Lint - name: Lint
run: make lint run: make lint
- name: Build - name: Build
run: make build run: make build
- name: Version - name: Version
run: ./build/joj3 -version run: ./build/joj3 -version
- name: Test - name: Test
run: | run: |
make prepare-test make prepare-test
make ci-test make ci-test
trigger-build-image: trigger-build-image:
container: container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest
volumes: volumes:
- /home/actions/.ssh:/root/.ssh - /home/actions/.ssh:/root/.ssh
needs: build needs: build
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
steps: steps:
- name: Set up Git - name: Set up Git
run: | run: |
git config --global user.name "gitea-actions[bot]" git config --global user.name "gitea-actions[bot]"
git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com"
chown -R root:root /root/.ssh chown -R root:root /root/.ssh
- name: Clone, Commit and Push - name: Clone, Commit and Push
shell: bash shell: bash
run: | run: |
git clone ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/runner-images.git runner-images git clone ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/runner-images.git runner-images
cd runner-images cd runner-images
git submodule update --init --remote --force git submodule update --init --remote --force
git add -A git add -A
if echo "${{ github.event.head_commit.message }}" | grep -q "force build"; then if echo "${{ github.event.head_commit.message }}" | grep -q "force build"; then
git commit --allow-empty -m "chore: trigger force build gitea actions by JOJ3" git commit --allow-empty -m "chore: trigger force build gitea actions by JOJ3"
else else
git commit --allow-empty -m "chore: trigger gitea actions by JOJ3" git commit --allow-empty -m "chore: trigger gitea actions by JOJ3"
fi fi
git push git push

View File

@ -1,49 +1,47 @@
---
name: submodules sync name: submodules sync
on: on:
push: push:
branches: branches:
- master - master
jobs: jobs:
sync: sync:
container: container:
image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest
volumes: volumes:
- /home/actions/.ssh:/root/.ssh - /home/actions/.ssh:/root/.ssh
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: https://gitea.com/BoYanZh/checkout@focs uses: https://gitea.com/BoYanZh/checkout@focs
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Git - name: Set up Git
run: | run: |
git config --global user.name "gitea-actions[bot]" git config --global user.name "gitea-actions[bot]"
git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com" git config --global user.email "gitea-actions[bot]@users.noreply.gitea.com"
chown -R root:root /root/.ssh chown -R root:root /root/.ssh
git remote set-url origin ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3.git git remote set-url origin ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3.git
- name: Check Git status - name: Check Git status
run: | run: |
echo git remote -v echo git remote -v
git remote -v git remote -v
echo ssh -T git@focs.ji.sjtu.edu.cn -p 2222 echo ssh -T git@focs.ji.sjtu.edu.cn -p 2222
ssh -T git@focs.ji.sjtu.edu.cn -p 2222 ssh -T git@focs.ji.sjtu.edu.cn -p 2222
echo git status echo git status
git status git status
- name: Git Submodule Update - name: Git Submodule Update
run: | run: |
git submodule init git submodule init
git submodule update --init --recursive git submodule update --init --recursive
git pull --recurse-submodules git pull --recurse-submodules
git submodule update --remote --recursive git submodule update --remote --recursive
- name: Commit update - name: Commit update
shell: bash shell: bash
run: | run: |
git fetch --all git fetch --all
git checkout master git checkout master
git reset --hard origin/master git reset --hard origin/master
git status git status
git add . git add .
git status git status
git diff-index --quiet HEAD || git commit -m "chore: update submodule references" git diff-index --quiet HEAD || git commit -m "chore: update submodule references"
git push git push

View File

@ -1,13 +1,12 @@
---
linters: linters:
enable: enable:
- gosec - gosec
- gocritic - gocritic
- gofumpt - gofumpt
- gofmt - gofmt
- goimports - goimports
issues: issues:
exclude-rules: exclude-rules:
- linters: - linters:
- gosec - gosec
text: G601 # false positive since go 1.22 text: G601 # false positive since go 1.22

View File

@ -1,37 +1,36 @@
---
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v5.0.0
hooks: hooks:
- id: check-yaml - id: check-yaml
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/mrtazz/checkmake.git - repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2 rev: 0.2.2
hooks: hooks:
- id: checkmake - id: checkmake
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt - repo: https://github.com/google/yamlfmt
rev: 0.2.3 rev: v0.13.0
hooks: hooks:
- id: yamlfmt - id: yamlfmt
- repo: https://github.com/dnephin/pre-commit-golang - repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1 rev: v0.5.1
hooks: hooks:
- id: golangci-lint - id: golangci-lint
- id: go-mod-tidy - id: go-mod-tidy
# - repo: local # - repo: local
# hooks: # hooks:
# - id: make-build # - id: make-build
# name: make build # name: make build
# entry: make build # entry: make build
# language: system # language: system
# always_run: true # always_run: true
# stages: [pre-commit] # stages: [pre-commit]
# pass_filenames: false # pass_filenames: false
# - id: make-test # - id: make-test
# name: make test # name: make test
# entry: make test # entry: make test
# language: system # language: system
# always_run: true # always_run: true
# stages: [pre-commit] # stages: [pre-commit]
# pass_filenames: false # pass_filenames: false