Format yaml files (#615)

Closes #533

---------

Signed-off-by: adetunjii <adetunjithomas1@outlook.com>
This commit is contained in:
Samuel Adetunji 2024-06-14 21:40:06 +01:00 committed by GitHub
parent 6faa48a358
commit 93123f97a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 956 additions and 920 deletions

7
.config/format.yml Normal file
View File

@ -0,0 +1,7 @@
formatter:
type: basic
indent: 2
retain_line_breaks_single: true
exclude:
- "deps/"

View File

@ -2,7 +2,6 @@
# package ecosystems to update and where the package manifests are located. # package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options: # Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
---
version: 2 version: 2
updates: updates:
- package-ecosystem: github-actions - package-ecosystem: github-actions

View File

@ -6,7 +6,6 @@ permissions:
contents: read contents: read
jobs: jobs:
test-ubuntu-latest: test-ubuntu-latest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -89,3 +88,39 @@ jobs:
dnf -y install epel-release gcc make procps-ng which dnf -y install epel-release gcc make procps-ng which
make -j SERVER_CFLAGS='-Werror' make -j SERVER_CFLAGS='-Werror'
format-yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: "1.22.4"
- name: Setup YAML formatter
run: |
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
- name: Run yamlfmt
id: yamlfmt
run: |
yamlfmt -lint -conf .config/format.yml .
# Capture the diff output
DIFF=$(git diff)
if [ ! -z "$DIFF" ]; then
# Encode the diff in Base64 to ensure it's handled as a single line
ENCODED_DIFF=$(echo "$DIFF" | base64 -w 0)
echo "diff=$ENCODED_DIFF" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Check for formatting changes
if: ${{ steps.yamlfmt.outputs.diff }}
run: |
echo "ERROR: YAML file is not formatted properly. Here is the diff: "
# Decode the Base64 diff to display it
echo "${{ steps.clang-format.outputs.diff }}" | base64 --decode
exit 1
shell: bash

View File

@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'cpp' ] language: ['cpp']
steps: steps:
- name: Checkout repository - name: Checkout repository

View File

@ -4,35 +4,34 @@ on:
pull_request: pull_request:
branches: branches:
# any PR to a release branch. # any PR to a release branch.
- '[0-9].[0-9]' - "[0-9].[0-9]"
schedule: schedule:
- cron: '0 0 * * *' - cron: "0 0 * * *"
workflow_dispatch: workflow_dispatch:
inputs: inputs:
skipjobs: skipjobs:
description: 'jobs to skip (delete the ones you wanna keep, do not leave empty)' description: "jobs to skip (delete the ones you wanna keep, do not leave empty)"
default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,rpm-distros,malloc,specific,fortify,reply-schema' default: "valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,rpm-distros,malloc,specific,fortify,reply-schema"
skiptests: skiptests:
description: 'tests to skip (delete the ones you wanna keep, do not leave empty)' description: "tests to skip (delete the ones you wanna keep, do not leave empty)"
default: 'valkey,modules,sentinel,cluster,unittest' default: "valkey,modules,sentinel,cluster,unittest"
test_args: test_args:
description: 'extra test arguments' description: "extra test arguments"
default: '' default: ""
cluster_test_args: cluster_test_args:
description: 'extra cluster / sentinel test arguments' description: "extra cluster / sentinel test arguments"
default: '' default: ""
use_repo: use_repo:
description: 'repo owner and name' description: "repo owner and name"
default: 'valkey-io/valkey' default: "valkey-io/valkey"
use_git_ref: use_git_ref:
description: 'git branch or sha to use' description: "git branch or sha to use"
default: 'unstable' default: "unstable"
permissions: permissions:
contents: read contents: read
jobs: jobs:
test-ubuntu-jemalloc: test-ubuntu-jemalloc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: | if: |
@ -388,10 +387,7 @@ jobs:
run: | run: |
make SERVER_CFLAGS='-Werror' make SERVER_CFLAGS='-Werror'
- name: testprep - name: testprep
run: | run: "sudo apt-get install vmtouch\nmkdir /tmp/master \nmkdir /tmp/slave\n"
sudo apt-get install vmtouch
mkdir /tmp/master
mkdir /tmp/slave
- name: warm up - name: warm up
run: | run: |
./src/valkey-server --daemonize yes --logfile /dev/null ./src/valkey-server --daemonize yes --logfile /dev/null
@ -413,7 +409,6 @@ jobs:
CACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}') CACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')
echo "$CACHE" echo "$CACHE"
if [ "$(( $CACHE-$CACHE0 ))" -gt "8000000" ]; then exit 1; fi if [ "$(( $CACHE-$CACHE0 ))" -gt "8000000" ]; then exit 1; fi
echo "test replication doesn't increase cache" echo "test replication doesn't increase cache"
./src/valkey-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null ./src/valkey-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null
while [ $(./src/valkey-cli -p 8081 info replication | grep "master_link_status:down") ]; do sleep 1; done; while [ $(./src/valkey-cli -p 8081 info replication | grep "master_link_status:down") ]; do sleep 1; done;
@ -580,7 +575,7 @@ jobs:
timeout-minutes: 14400 timeout-minutes: 14400
strategy: strategy:
matrix: matrix:
compiler: [ gcc, clang ] compiler: [gcc, clang]
env: env:
CC: ${{ matrix.compiler }} CC: ${{ matrix.compiler }}
steps: steps:
@ -630,7 +625,7 @@ jobs:
timeout-minutes: 14400 timeout-minutes: 14400
strategy: strategy:
matrix: matrix:
compiler: [ gcc, clang ] compiler: [gcc, clang]
env: env:
CC: ${{ matrix.compiler }} CC: ${{ matrix.compiler }}
steps: steps: