style: Improve actions and workflows style (#2060)

This commit is contained in:
Ayaz Salikhov
2025-04-30 11:55:27 +01:00
committed by GitHub
parent 5860a90b94
commit b2a1b34ae6
23 changed files with 77 additions and 18 deletions

View File

@@ -23,4 +23,7 @@ runs:
shell: bash shell: bash
run: | run: |
cd build cd build
cmake --build . --parallel ${{ steps.number_of_threads.outputs.threads_number }} --target ${{ inputs.targets }} cmake \
--build . \
--parallel ${{ steps.number_of_threads.outputs.threads_number }} \
--target ${{ inputs.targets }}

View File

@@ -29,32 +29,32 @@ runs:
steps: steps:
- name: Login to DockerHub - name: Login to DockerHub
if: ${{ inputs.push_image == 'true' }} if: ${{ inputs.push_image == 'true' }}
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0 uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with: with:
username: ${{ env.DOCKERHUB_USER }} username: ${{ env.DOCKERHUB_USER }}
password: ${{ env.DOCKERHUB_PW }} password: ${{ env.DOCKERHUB_PW }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: ${{ inputs.push_image == 'true' }} if: ${{ inputs.push_image == 'true' }}
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0 uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ env.GITHUB_TOKEN }} password: ${{ env.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 #v3.6.0 - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with: with:
cache-image: false cache-image: false
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 #v3.10.0 - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 #v5.7.0 - uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
id: meta id: meta
with: with:
images: ${{ inputs.images }} images: ${{ inputs.images }}
tags: ${{ inputs.tags }} tags: ${{ inputs.tags }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 #v6.16.0 uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
with: with:
context: ${{ inputs.directory }} context: ${{ inputs.directory }}
platforms: ${{ inputs.platforms }} platforms: ${{ inputs.platforms }}
@@ -63,7 +63,7 @@ runs:
- name: Update DockerHub description - name: Update DockerHub description
if: ${{ inputs.push_image == 'true' }} if: ${{ inputs.push_image == 'true' }}
uses: peter-evans/dockerhub-description@432a30c9e07499fd01da9f8a49f0faf9e0ca5b77 #v4.0.2 uses: peter-evans/dockerhub-description@432a30c9e07499fd01da9f8a49f0faf9e0ca5b77 # v4.0.2
with: with:
username: ${{ env.DOCKERHUB_USER }} username: ${{ env.DOCKERHUB_USER }}
password: ${{ env.DOCKERHUB_PW }} password: ${{ env.DOCKERHUB_PW }}

View File

@@ -1,5 +1,6 @@
name: Generate code coverage report name: Generate code coverage report
description: Run tests, generate code coverage report and upload it to codecov.io description: Run tests, generate code coverage report and upload it to codecov.io
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -1,5 +1,6 @@
name: Create an issue name: Create an issue
description: Create an issue description: Create an issue
inputs: inputs:
title: title:
description: Issue title description: Issue title
@@ -15,10 +16,12 @@ inputs:
description: Comma-separated list of assignees description: Comma-separated list of assignees
required: true required: true
default: "godexsoft,kuznetsss,PeterChen13579" default: "godexsoft,kuznetsss,PeterChen13579"
outputs: outputs:
created_issue_id: created_issue_id:
description: Created issue id description: Created issue id
value: ${{ steps.create_issue.outputs.created_issue }} value: ${{ steps.create_issue.outputs.created_issue }}
runs: runs:
using: composite using: composite
steps: steps:
@@ -27,7 +30,12 @@ runs:
shell: bash shell: bash
run: | run: |
echo -e '${{ inputs.body }}' > issue.md echo -e '${{ inputs.body }}' > issue.md
gh issue create --assignee '${{ inputs.assignees }}' --label '${{ inputs.labels }}' --title '${{ inputs.title }}' --body-file ./issue.md > create_issue.log gh issue create \
--assignee '${{ inputs.assignees }}' \
--label '${{ inputs.labels }}' \
--title '${{ inputs.title }}' \
--body-file ./issue.md \
> create_issue.log
created_issue=$(cat create_issue.log | sed 's|.*/||') created_issue=$(cat create_issue.log | sed 's|.*/||')
echo "created_issue=$created_issue" >> $GITHUB_OUTPUT echo "created_issue=$created_issue" >> $GITHUB_OUTPUT
rm create_issue.log issue.md rm create_issue.log issue.md

View File

@@ -1,5 +1,6 @@
name: Run conan and cmake name: Run conan and cmake
description: Run conan and cmake description: Run conan and cmake
inputs: inputs:
conan_profile: conan_profile:
description: Conan profile name description: Conan profile name
@@ -27,7 +28,13 @@ inputs:
sanitizer: sanitizer:
description: Sanitizer to use description: Sanitizer to use
required: true required: true
default: "false" # false, tsan, asan or ubsan default: "false"
choices:
- "false"
- "tsan"
- "asan"
- "ubsan"
runs: runs:
using: composite using: composite
steps: steps:
@@ -44,7 +51,17 @@ runs:
INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}" INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}"
run: | run: |
cd build cd build
conan install .. -of . -b $BUILD_OPTION -s build_type=${{ inputs.build_type }} -o clio:static="${STATIC_OPTION}" -o clio:tests=True -o clio:integration_tests="${INTEGRATION_TESTS_OPTION}" -o clio:lint=False -o clio:coverage="${CODE_COVERAGE}" --profile ${{ inputs.conan_profile }} conan \
install .. \
-of . \
-b $BUILD_OPTION \
-s build_type=${{ inputs.build_type }} \
-o clio:static="${STATIC_OPTION}" \
-o clio:tests=True \
-o clio:integration_tests="${INTEGRATION_TESTS_OPTION}" \
-o clio:lint=False \
-o clio:coverage="${CODE_COVERAGE}" \
--profile ${{ inputs.conan_profile }}
- name: Run cmake - name: Run cmake
shell: bash shell: bash
@@ -57,4 +74,9 @@ runs:
'' }} '' }}
run: | run: |
cd build cd build
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${SANITIZER_OPTION} .. -G Ninja cmake \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
${SANITIZER_OPTION} \
.. \
-G Ninja

View File

@@ -1,5 +1,6 @@
name: Get number of threads name: Get number of threads
description: Determines number of threads to use on macOS and Linux description: Determines number of threads to use on macOS and Linux
inputs: inputs:
subtract_threads: subtract_threads:
description: How many threads to subtract from the calculated number description: How many threads to subtract from the calculated number
@@ -9,6 +10,7 @@ outputs:
threads_number: threads_number:
description: Number of threads to use description: Number of threads to use
value: ${{ steps.number_of_threads_export.outputs.num }} value: ${{ steps.number_of_threads_export.outputs.num }}
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -1,9 +1,11 @@
name: Git common ancestor name: Git common ancestor
description: Find the closest common commit description: Find the closest common commit
outputs: outputs:
commit: commit:
description: Hash of commit description: Hash of commit
value: ${{ steps.find_common_ancestor.outputs.commit }} value: ${{ steps.find_common_ancestor.outputs.commit }}
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -1,9 +1,11 @@
name: Prepare runner name: Prepare runner
description: Install packages, set environment variables, create directories description: Install packages, set environment variables, create directories
inputs: inputs:
disable_ccache: disable_ccache:
description: Whether ccache should be disabled description: Whether ccache should be disabled
required: true required: true
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -1,5 +1,6 @@
name: Restore cache name: Restore cache
description: Find and restores conan and ccache cache description: Find and restores conan and ccache cache
inputs: inputs:
conan_dir: conan_dir:
description: Path to .conan directory description: Path to .conan directory
@@ -28,6 +29,7 @@ outputs:
ccache_cache_hit: ccache_cache_hit:
description: True if ccache cache has been downloaded description: True if ccache cache has been downloaded
value: ${{ steps.ccache_cache.outputs.cache-hit }} value: ${{ steps.ccache_cache.outputs.cache-hit }}
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -1,5 +1,6 @@
name: Save cache name: Save cache
description: Save conan and ccache cache for develop branch description: Save conan and ccache cache for develop branch
inputs: inputs:
conan_dir: conan_dir:
description: Path to .conan directory description: Path to .conan directory
@@ -29,6 +30,7 @@ inputs:
description: Whether code coverage is on description: Whether code coverage is on
required: true required: true
default: "false" default: "false"
runs: runs:
using: composite using: composite
steps: steps:

View File

@@ -68,11 +68,14 @@ jobs:
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:latest image: ghcr.io/xrplf/clio-ci:latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: clio_server_Linux_Release_gcc name: clio_server_Linux_Release_gcc
- name: Compare Config Description - name: Compare Config Description
shell: bash shell: bash
run: | run: |

View File

@@ -47,6 +47,7 @@ jobs:
build_and_publish_image: build_and_publish_image:
name: Build and publish image name: Build and publish image
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -62,7 +62,7 @@ jobs:
steps: steps:
- name: Clean workdir - name: Clean workdir
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0 uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce # v1.0
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:

View File

@@ -80,9 +80,11 @@ jobs:
needs: [build, run_tests] needs: [build, run_tests]
if: ${{ always() && contains(needs.*.result, 'failure') }} if: ${{ always() && contains(needs.*.result, 'failure') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
issues: write issues: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -8,8 +8,9 @@ on:
jobs: jobs:
check_title: check_title:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: ytanikin/pr-conventional-commits@8267db1bacc237419f9ed0228bb9d94e94271a1d #v1.4.1 - uses: ytanikin/pr-conventional-commits@8267db1bacc237419f9ed0228bb9d94e94271a1d # v1.4.1
with: with:
task_types: '["build","feat","fix","docs","test","ci","style","refactor","perf","chore"]' task_types: '["build","feat","fix","docs","test","ci","style","refactor","perf","chore"]'
add_label: false add_label: false

View File

@@ -24,6 +24,7 @@ jobs:
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:latest image: ghcr.io/xrplf/clio-ci:latest
permissions: permissions:
contents: write contents: write
issues: write issues: write
@@ -97,7 +98,7 @@ jobs:
List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/ List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/
- uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec #v6.3.0 - uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
if: ${{ steps.run_clang_tidy.outcome != 'success' }} if: ${{ steps.run_clang_tidy.outcome != 'success' }}
with: with:
gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }} gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }}
@@ -107,7 +108,7 @@ jobs:
- name: Create PR with fixes - name: Create PR with fixes
if: ${{ steps.run_clang_tidy.outcome != 'success' }} if: ${{ steps.run_clang_tidy.outcome != 'success' }}
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7.0.8 uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
env: env:
GH_REPO: ${{ github.repository }} GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}

View File

@@ -1,4 +1,5 @@
name: Restart clang-tidy workflow name: Restart clang-tidy workflow
on: on:
push: push:
branches: [develop] branches: [develop]

View File

@@ -24,6 +24,7 @@ jobs:
continue-on-error: true continue-on-error: true
container: container:
image: ghcr.io/xrplf/clio-ci:latest image: ghcr.io/xrplf/clio-ci:latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -75,9 +75,11 @@ jobs:
needs: [build-and-test, nightly_release, build_and_publish_docker_image] needs: [build-and-test, nightly_release, build_and_publish_docker_image]
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name != 'pull_request' }} if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
issues: write issues: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -10,6 +10,7 @@ on:
jobs: jobs:
run-hooks: run-hooks:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo ⚡️ - name: Checkout Repo ⚡️
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -49,7 +49,7 @@ jobs:
steps: steps:
- name: Clean workdir - name: Clean workdir
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0 uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce # v1.0
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@@ -116,7 +116,7 @@ jobs:
steps: steps:
- name: Clean workdir - name: Clean workdir
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0 uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce # v1.0
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:

View File

@@ -27,6 +27,7 @@ jobs:
build_and_push: build_and_push:
name: Build and push docker image name: Build and push docker image
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/build_docker_image - uses: ./.github/actions/build_docker_image

View File

@@ -11,6 +11,7 @@ jobs:
upload_report: upload_report:
name: Upload report name: Upload report
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with: