style(ci): lint and standardize the actions structure (#3940)

* style(ci): comply with https://json.schemastore.org/github-workflow.json

Some substituions were harder to make as files were not standardized

* fix(mergify): use correct name for macos

* style(actions): revert to single quotes

* style: lint dependabot and mergify conf files

* style: remove conditions with missing context

* imp(lint): automate GH Actions linting

* fix(lint): some actions need to be triggered by PR event

* fix(lint): consider all workflow YAMLs

* Use the same paths in the patch file

* revert: keep condition as is

* add TODO

* fix: add missing checkpoint_sync input

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Gustavo Valverde 2022-04-12 01:06:37 -04:00 committed by GitHub
parent d09769714f
commit 831a2009bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 366 additions and 345 deletions

View File

@ -1,22 +1,22 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
- package-ecosystem: cargo
directory: '/'
schedule:
interval: daily
timezone: America/New_York
open-pull-requests-limit: 10
labels:
- "A-dependencies"
- "A-rust"
- "P-Low :snowflake:"
- package-ecosystem: github-actions
directory: "/"
- 'A-dependencies'
- 'A-rust'
- 'P-Low :snowflake:'
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
timezone: America/New_York
open-pull-requests-limit: 10
labels:
- "A-infrastructure"
- "A-dependencies"
- "P-Low :snowflake:"
- 'A-infrastructure'
- 'A-dependencies'
- 'P-Low :snowflake:'

24
.github/mergify.yml vendored
View File

@ -10,7 +10,7 @@ queue_rules:
- check-success=Test full validation sync from cached state
- check-success=Test stable zebra-state with fake activation heights on ubuntu-latest
- check-success=Test stable on ubuntu-latest
- check-success=Test stable on macOS-latest
- check-success=Test stable on macos-latest
# TODO: Windows was removed for now, see https://github.com/ZcashFoundation/zebra/issues/3801
# - check-success=Test stable on windows-latest
- check-success=Clippy
@ -27,7 +27,7 @@ queue_rules:
- check-success=Test full validation sync from cached state
- check-success=Test stable zebra-state with fake activation heights on ubuntu-latest
- check-success=Test stable on ubuntu-latest
- check-success=Test stable on macOS-latest
- check-success=Test stable on macos-latest
# - check-success=Test stable on windows-latest
- check-success=Clippy
- check-success=Rustfmt
@ -43,7 +43,7 @@ queue_rules:
- check-success=Test full validation sync from cached state
- check-success=Test stable zebra-state with fake activation heights on ubuntu-latest
- check-success=Test stable on ubuntu-latest
- check-success=Test stable on macOS-latest
- check-success=Test stable on macos-latest
# - check-success=Test stable on windows-latest
- check-success=Clippy
- check-success=Rustfmt
@ -51,13 +51,13 @@ queue_rules:
pull_request_rules:
- name: move to urgent queue when CI passes with 1 review and not WIP targeting main
conditions:
- "#approved-reviews-by>=1"
- "#review-threads-unresolved=0"
- '#approved-reviews-by>=1'
- '#review-threads-unresolved=0'
- -draft
- base=main
- or:
- "label~=^P-Critical"
- "label~=^P-High"
- 'label~=^P-Critical'
- 'label~=^P-High'
- label!=do-not-merge
actions:
queue:
@ -66,11 +66,11 @@ pull_request_rules:
- name: move to medium queue when CI passes with 1 review and not WIP targeting main
conditions:
- "#approved-reviews-by>=1"
- "#review-threads-unresolved=0"
- '#approved-reviews-by>=1'
- '#review-threads-unresolved=0'
- -draft
- base=main
- "label~=^P-Medium"
- 'label~=^P-Medium'
- label!=do-not-merge
actions:
queue:
@ -79,8 +79,8 @@ pull_request_rules:
- name: move to low queue when CI passes with 1 review and not WIP targeting main
conditions:
- "#approved-reviews-by>=1"
- "#review-threads-unresolved=0"
- '#approved-reviews-by>=1'
- '#review-threads-unresolved=0'
- -draft
- base=main
- label!=do-not-merge

View File

@ -5,8 +5,12 @@ on:
inputs:
network:
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'
required: true
checkpoint_sync:
default: true
default: 'true'
description: 'Use as many checkpoints as possible when syncing'
required: true
push:
branches:
- main

View File

@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
# TODO: Windows was removed for now, see https://github.com/ZcashFoundation/zebra/issues/3801
os: [ubuntu-latest, macOS-latest]
os: [ubuntu-latest, macos-latest]
rust: [stable]
steps:

View File

@ -35,7 +35,7 @@ jobs:
fail-fast: false
matrix:
# TODO: Windows was removed for now, see https://github.com/ZcashFoundation/zebra/issues/3801
os: [ubuntu-latest, macOS-latest]
os: [ubuntu-latest, macos-latest]
rust: [stable]
steps:
@ -67,7 +67,7 @@ jobs:
# Ubuntu runners don't have reliable network or DNS during test steps.
# Windows runners have an unreliable network.
shell: bash
if: matrix.os != 'macOS-latest'
if: matrix.os != 'macos-latest'
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV
- name: Minimise proptest cases on macOS and Windows
@ -118,7 +118,7 @@ jobs:
- name: Run zebrad large sync tests
# Skip the entire step on Ubuntu and Windows, because the test would be skipped anyway due to ZEBRA_SKIP_NETWORK_TESTS
if: matrix.os == 'macOS-latest'
if: matrix.os == 'macos-latest'
uses: actions-rs/cargo@v1.0.3
with:
command: test
@ -159,7 +159,7 @@ jobs:
- name: Run tests with fake activation heights
uses: actions-rs/cargo@v1.0.3
env:
TEST_FAKE_ACTIVATION_HEIGHTS: ""
TEST_FAKE_ACTIVATION_HEIGHTS: ''
with:
command: test
# Note: this only runs the zebra-state crate tests,

View File

@ -5,7 +5,7 @@ on:
pull_request:
branches:
- main
types: [ closed ]
types: [closed]
env:
NETWORK: Mainnet

View File

@ -59,7 +59,7 @@ jobs:
# Exclude zebra-utils, it is not for library or app users
cargo doc --no-deps --workspace --exclude zebra-utils
env:
RUSTDOCFLAGS: "--html-in-header katex-header.html"
RUSTDOCFLAGS: '--html-in-header katex-header.html'
- name: Deploy external docs to firebase
uses: w9jds/firebase-action@v2.0.0
@ -73,7 +73,7 @@ jobs:
run: |
cargo doc --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--html-in-header katex-header.html"
RUSTDOCFLAGS: '--html-in-header katex-header.html'
- name: Deploy internal docs to firebase
uses: w9jds/firebase-action@v2.0.0

View File

@ -1,17 +1,16 @@
name: Lint Rust files
on:
push:
pull_request:
branches:
- "**"
- "!main"
- 'main'
paths-ignore:
- '**/*.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'clippy.toml'
- '.cargo/config.toml'
- '.github/workflows/lint.yml'
- '.github/workflows/*.yml'
jobs:
clippy:

View File

@ -1,10 +1,9 @@
name: Lint Rust files
on:
push:
pull_request:
branches:
- "**"
- "!main"
- 'main'
paths:
# code and tests
- '**/*.rs'
@ -14,7 +13,8 @@ on:
# workflow definitions
- 'clippy.toml'
- '.cargo/config.toml'
- '.github/workflows/lint.yml'
# TODO: we might want to run this in a separate workflow in the future for the `actionlint` job
- '.github/workflows/*.yml'
env:
CARGO_INCREMENTAL: 0
@ -82,3 +82,9 @@ jobs:
with:
command: fmt
args: --all -- --check
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-actionlint@v1.21.0

View File

@ -5,6 +5,12 @@ on:
inputs:
network:
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'
required: true
checkpoint_sync:
default: 'true'
description: 'Configures `zebrad` to use as many checkpoints as possible'
required: true
pull_request:
branches:
- main
@ -24,7 +30,7 @@ on:
env:
CARGO_INCREMENTAL: '1'
ZEBRA_SKIP_IPV6_TESTS: "1"
ZEBRA_SKIP_IPV6_TESTS: '1'
RUST_BACKTRACE: full
RUST_LIB_BACKTRACE: full
COLORBT_SHOW_HIDDEN: '1'
@ -132,7 +138,7 @@ jobs:
test-full-sync:
name: Test full Mainnet sync
runs-on: ubuntu-latest
needs: [ build ]
needs: [build]
permissions:
contents: 'read'
id-token: 'write'

View File

@ -25,7 +25,6 @@ jobs:
name: Test all
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' }}
steps:
- run: 'echo "No build required"'
@ -33,7 +32,6 @@ jobs:
name: Test with fake activation heights
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' }}
steps:
- run: 'echo "No build required"'
@ -42,7 +40,6 @@ jobs:
name: Test checkpoint sync from empty state
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' }}
steps:
- run: 'echo "No build required"'
@ -57,8 +54,6 @@ jobs:
name: Regenerate stateful disks
runs-on: ubuntu-latest
needs: build
outputs:
disk_short_sha: ${{ steps.disk-short-sha.outputs.disk_short_sha }}
steps:
- run: 'echo "No build required"'
@ -66,6 +61,6 @@ jobs:
test-stateful-sync:
name: Test full validation sync from cached state
runs-on: ubuntu-latest
needs: [ build, regenerate-stateful-disks]
needs: [build, regenerate-stateful-disks]
steps:
- run: 'echo "No build required"'

View File

@ -5,10 +5,17 @@ on:
inputs:
network:
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'
required: true
checkpoint_sync:
default: 'true'
description: 'Configures `zebrad` to use as many checkpoints as possible'
required: true
regenerate-disks:
type: boolean
default: false
description: Just update stateful disks
description: 'Just update stateful disks'
required: true
pull_request:
branches:
- main
@ -358,7 +365,7 @@ jobs:
test-stateful-sync:
name: Test full validation sync from cached state
runs-on: ubuntu-latest
needs: [ build, regenerate-stateful-disks]
needs: [build, regenerate-stateful-disks]
permissions:
contents: 'read'
id-token: 'write'

View File

@ -4,9 +4,13 @@ on:
workflow_dispatch:
inputs:
network:
default: 'Testnet'
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'
required: true
size:
default: 10
default: '10'
description: 'GCP Managed Instance Group size'
required: true
env:
PROJECT_ID: zealous-zebra