diff --git a/.github/actionlint.yml b/.github/actionlint.yml new file mode 100644 index 000000000..7a735464a --- /dev/null +++ b/.github/actionlint.yml @@ -0,0 +1,26 @@ +self-hosted-runner: + # Labels of self-hosted runner in array of strings. + labels: ["benchmark", "glue-notify"] + +# Configuration variables in array of strings defined in your repository or +# organization. `null` means disabling configuration variables check. +# Empty array means no configuration variable is allowed. +config-variables: null + +# Configuration for file paths. The keys are glob patterns to match to file +# paths relative to the repository root. The values are the configurations for +# the file paths. Note that the path separator is always '/'. +# The following configurations are available. +# +# "ignore" is an array of regular expression patterns. Matched error messages +# are ignored. This is similar to the "-ignore" command line option. +paths: + # .github/workflows/**/*.yml: + # ignore: [] + # ".github/workflows/*.y*ml": + # ignore: ["string should not be empty", ".* SC2002:.*"] + # ".github/workflows/test-single.yml": + # ignore: [ + # # special case here using a variable as a key in the excludes + # 'value .*\$\{\{ inputs.matrix_mode \}\}.* in "exclude" does not match in matrix "python" combinations. possible values are', + # ] diff --git a/.github/workflows/build-crate.yml b/.github/workflows/build-crate.yml index 825db9a62..eeee07ac3 100644 --- a/.github/workflows/build-crate.yml +++ b/.github/workflows/build-crate.yml @@ -73,6 +73,9 @@ jobs: matrix: package: - name: chia-consensus + env: + # EXAMPLE_ as an example and to appease actionlint + EXAMPLE_LSAN_OPTIONS: detect_leaks=0 - name: chia-bls - name: clvm-utils - name: chia-protocol @@ -98,4 +101,4 @@ jobs: env: ${{ matrix.package.env || fromJSON('{}') }} run: | cd crates/"${{ matrix.package.name }}" - cargo fuzz list | xargs -I "%" sh -c "cargo +"${{ matrix.toolchain }}" fuzz run % -- -max_total_time=${{ matrix.max_total_time}} || exit 255" + cargo fuzz list | xargs -I "%" sh -c "cargo +'${{ matrix.toolchain }}' fuzz run % -- -max_total_time=${{ matrix.max_total_time}} || exit 255" diff --git a/.github/workflows/build-riscv64.yml b/.github/workflows/build-riscv64.yml index f0a7eb358..43b447d40 100644 --- a/.github/workflows/build-riscv64.yml +++ b/.github/workflows/build-riscv64.yml @@ -134,6 +134,7 @@ jobs: run: | aws s3 ls s3://download.chia.net/simple/chia-rs/ > existing_wheel_list_raw cat existing_wheel_list_raw + # shellcheck disable=SC2002 cat existing_wheel_list_raw | tr -s ' ' | cut -d ' ' -f 4 > existing_wheel_list - name: List new wheels @@ -141,6 +142,7 @@ jobs: shell: sh run: | (cd target/wheels/; ls chia_rs-*.whl) > new_wheel_list + # shellcheck disable=SC2002 cat new_wheel_list | xargs -I % sh -c 'ls -l target/wheels/%' - name: Choose wheels to upload @@ -154,4 +156,5 @@ jobs: if: env.RELEASE == 'true' shell: sh run: | + # shellcheck disable=SC2002 cat upload_wheel_list | xargs -I % sh -c 'aws s3 cp target/wheels/% s3://download.chia.net/simple/chia-rs/' diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 9d68d5770..1f24dfa92 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -153,14 +153,14 @@ jobs: python -m pip install --upgrade pip python -m pip install maturin - - name: Build MacOs with maturin on Python ${{ matrix.python }} + - name: Build MacOs with maturin on Python ${{ matrix.python.major-dot-minor }} if: matrix.os.matrix == 'macos' env: MACOSX_DEPLOYMENT_TARGET: "13.0" run: | maturin build -i python --release -m wheel/Cargo.toml --features=openssl,pyo3/extension-module - - name: Build Linux with maturin on Python ${{ matrix.python }} + - name: Build Linux with maturin on Python ${{ matrix.python.major-dot-minor }} if: matrix.os.matrix == 'ubuntu' run: | docker run --rm --pull always \ @@ -178,7 +178,7 @@ jobs: CC=gcc maturin build --release --manylinux ${{ matrix.python.by-arch[matrix.arch.matrix].manylinux-version }} -m wheel/Cargo.toml --features=openssl,pyo3/extension-module \ ' - - name: Build Windows with maturin on Python ${{ matrix.python }} + - name: Build Windows with maturin on Python ${{ matrix.python.major-dot-minor }} if: matrix.os.matrix == 'windows' env: CC: "clang" @@ -264,14 +264,14 @@ jobs: pip install maturin maturin sdist -m wheel/Cargo.toml cd target/wheels - dirname=`basename chia_rs*.tar.gz .tar.gz` - echo $dirname - mkdir $dirname - cp -r ../../src/ $dirname/src/ + dirname=$(basename chia_rs*.tar.gz .tar.gz) + echo "$dirname" + mkdir "$dirname" + cp -r ../../src/ "$dirname/src/" gunzip chia_rs*.tar.gz - tar rvf chia_rs*.tar $dirname/src + tar rvf chia_rs*.tar "$dirname/src" gzip chia_rs*.tar - rm -rf $dirname + rm -rf "$dirname" - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -310,6 +310,23 @@ jobs: run: | cargo clippy --workspace --all-features --all-targets + actionlint: + runs-on: ubuntu-latest + permissions: + contents: none + steps: + - uses: actions/checkout@v4 + + - name: actionlint + run: | + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + echo ==== shellcheck version + shellcheck --version + echo ==== actionlint version + ./actionlint --version + echo ==== running actionlint + ./actionlint -color -shellcheck shellcheck + unit_tests: runs-on: ${{ matrix.os }} strategy: @@ -332,9 +349,11 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | cargo install grcov --locked - echo "RUSTFLAGS=-Cinstrument-coverage" >> "$GITHUB_ENV" - echo "LLVM_PROFILE_FILE=$(pwd)/target/chia_rs-%p-%m.profraw" >> "$GITHUB_ENV" - echo "CARGO_TARGET_DIR=$(pwd)/target" >> "$GITHUB_ENV" + { + echo "RUSTFLAGS=-Cinstrument-coverage" + echo "LLVM_PROFILE_FILE=$(pwd)/target/chia_rs-%p-%m.profraw" + echo "CARGO_TARGET_DIR=$(pwd)/target" + } >> "$GITHUB_ENV" - name: cargo test (not windows) if: matrix.os != 'windows-latest' run: cargo test --workspace --all-features diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 000000000..6eccb2a81 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC2002