Skip to content

Commit

Permalink
chore: use yamlfmt for all yaml files (but not helm templates) (#2130)
Browse files Browse the repository at this point in the history
### Summary
- Add yamlfmt config to root
- Recommend yamlfmt vscode extension

This formatter with current config doesn't wrap long lines, which saves us a lot of lines.

Install formatter with homebrew or:

```
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
```

Blog writeup on the formatter: https://til.simonwillison.net/yaml/yamlfmt

Alternative to #2124
  • Loading branch information
corneliusroemer authored Jun 17, 2024
1 parent 2e537ac commit f7401b2
Show file tree
Hide file tree
Showing 33 changed files with 147 additions and 414 deletions.
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ updates:
interval: monthly
groups:
minorAndPatch:
update-types:
- "minor"
- "patch"
update-types:
- "minor"
- "patch"
- package-ecosystem: docker
directories:
- website
Expand All @@ -58,6 +58,6 @@ updates:
interval: weekly
groups:
minorAndPatch:
update-types:
- "minor"
- "patch"
update-types:
- "minor"
- "patch"
2 changes: 0 additions & 2 deletions .github/workflows/actions-usage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Github Actions Usage Stats

on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *" # Runs at 03:00 AM (UTC) every day

jobs:
gha-usage-minutes-report:
runs-on: ubuntu-latest
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/backend-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: backend-image

on:
pull_request:
push:
Expand All @@ -19,17 +18,14 @@ on:
description: "Build for ARM as well"
default: "false"
required: true

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/backend
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-backend
cancel-in-progress: true

jobs:
backend-image:
name: Build Backend Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
Expand All @@ -45,13 +41,11 @@ jobs:
- name: Shorten sha
run: echo "sha=${sha::7}" >> $GITHUB_ENV
- uses: actions/checkout@v4

- name: Generate files hash
id: files-hash
run: |
DIR_HASH=$(echo -n ${{ hashFiles('backend/**', '.github/workflows/backend-image.yml') }})
echo "DIR_HASH=$DIR_HASH${{ env.BUILD_ARM == 'true' && '-arm' || '' }}" >> $GITHUB_ENV
- name: Setup Docker metadata
id: dockerMetadata
uses: docker/metadata-action@v5
Expand All @@ -69,32 +63,26 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check if image exists
id: check-image
run: |
EXISTS=$(docker manifest inspect ${{ env.DOCKER_IMAGE_NAME }}:${{ env.DIR_HASH }} > /dev/null 2>&1 && echo "true" || echo "false")
echo "CACHE_HIT=$EXISTS" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK
if: env.CACHE_HIT == 'false'
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "adopt"

- name: Setup Gradle
if: env.CACHE_HIT == 'false'
uses: gradle/actions/setup-gradle@v3

- name: Build Backend
if: env.CACHE_HIT == 'false'
working-directory: ./backend
run: ./gradlew bootJar

- name: Build and push image if input files changed
if: env.CACHE_HIT == 'false'
uses: docker/build-push-action@v5
Expand All @@ -105,7 +93,6 @@ jobs:
cache-from: type=gha,scope=backend-${{ github.ref }}
cache-to: type=gha,mode=max,scope=backend-${{ github.ref }}
platforms: ${{ env.BUILD_ARM == 'true' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}

- name: Retag and push existing image if cache hit
if: env.CACHE_HIT == 'true'
run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: backend-tests

on:
pull_request:
paths:
Expand All @@ -9,11 +8,9 @@ on:
branches:
- main
workflow_dispatch:

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-backend-tests
cancel-in-progress: true

jobs:
Tests:
runs-on: codebuild-loculus-ci-${{ github.run_id }}-${{ github.run_attempt }}
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/build-arm-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,35 @@

on:
workflow_dispatch:

permissions:
contents: read
packages: write
checks: read

jobs:
trigger-backend:
uses: ./.github/workflows/backend-image.yml
with:
build_arm: true

trigger-config-preprocessor:
uses: ./.github/workflows/config-preprocessor-image.yml
with:
build_arm: true

trigger-dummy-preprocessing:
uses: ./.github/workflows/preprocessing-dummy-image.yml
with:
build_arm: true

trigger-ingest:
uses: ./.github/workflows/ingest-image.yml
with:
build_arm: true

trigger-keycloakify:
uses: ./.github/workflows/keycloakify-image.yml
with:
build_arm: true

trigger-preprocessing-nextclade:
uses: ./.github/workflows/preprocessing-nextclade-image.yml
with:
build_arm: true

trigger-website:
uses: ./.github/workflows/website-image.yml
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/clean-cache-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
description: "Branch name"
required: false
default: ""

jobs:
cleanup:
runs-on: ubuntu-latest
Expand All @@ -29,7 +28,6 @@ jobs:
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/config-preprocessor-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: config-processor-image

on:
pull_request:
push:
Expand All @@ -19,21 +18,17 @@ on:
description: "Build for ARM as well"
default: "false"
required: true

env:
DOCKER_IMAGE_NAME: ghcr.io/loculus-project/config-processor
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BUILD_ARM: ${{ github.event.inputs.build_arm || inputs.build_arm || github.ref == 'refs/heads/main' }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}

defaults:
run:
working-directory: ./kubernetes/config-processor

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-config-processor-${{github.event.inputs.build_arm}}
cancel-in-progress: true

jobs:
config-processor-image:
name: Build config-processor Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dependabot-validate.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: dependabot validate

on:
pull_request:
paths:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
name: Builds and deploy documentation

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build-and-deploy:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ./docs/.nvmrc

- name: Navigate to docs directory
run: cd docs

- name: Install Dependencies
run: npm install
working-directory: ./docs

- name: Build Project
run: npm run build
working-directory: ./docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Docs Build Check

on:
pull_request:
paths:
Expand All @@ -8,31 +7,24 @@ on:
push:
branches:
- main

workflow_dispatch:

concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-docs-build
cancel-in-progress: true

jobs:
check-docs-build:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ./docs/.nvmrc

- name: Install Dependencies
run: npm install
working-directory: ./docs

- name: Check Build
run: npm run build
working-directory: ./docs
Loading

0 comments on commit f7401b2

Please sign in to comment.