From e5ff5193bd20e7177e21bc626b129ce93b3449d8 Mon Sep 17 00:00:00 2001 From: Elias Tazartes Date: Tue, 26 Sep 2023 15:10:41 +0700 Subject: [PATCH] feat: add trunk to ssj --- .github/workflows/gas_reports.yml | 2 +- .github/workflows/gas_snapshot.yml | 4 ++- .github/workflows/test.yml | 4 ++- .github/workflows/trunk-check.yml | 24 ++++++++++++++++++ .trunk/.gitignore | 8 ++++++ .trunk/configs/.isort.cfg | 2 ++ .trunk/configs/.shellcheckrc | 7 ++++++ .trunk/configs/.yamllint.yaml | 10 ++++++++ .trunk/configs/ruff.toml | 5 ++++ .trunk/trunk.yaml | 40 ++++++++++++++++++++++++++++++ 10 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/trunk-check.yml create mode 100644 .trunk/.gitignore create mode 100644 .trunk/configs/.isort.cfg create mode 100644 .trunk/configs/.shellcheckrc create mode 100644 .trunk/configs/.yamllint.yaml create mode 100644 .trunk/configs/ruff.toml create mode 100644 .trunk/trunk.yaml diff --git a/.github/workflows/gas_reports.yml b/.github/workflows/gas_reports.yml index c0d31e5d5..02e510d23 100644 --- a/.github/workflows/gas_reports.yml +++ b/.github/workflows/gas_reports.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Scarb uses: software-mansion/setup-scarb@v1 with: - scarb-version: "0.7.0" + scarb-version: 0.7.0 - name: Run compare_snapshot script id: run-script diff --git a/.github/workflows/gas_snapshot.yml b/.github/workflows/gas_snapshot.yml index 5efd22d55..1c03898e3 100644 --- a/.github/workflows/gas_snapshot.yml +++ b/.github/workflows/gas_snapshot.yml @@ -1,5 +1,7 @@ name: Generate and Upload Gas Snapshot +permissions: read-all + on: push: branches: @@ -20,7 +22,7 @@ jobs: - name: Set up Scarb uses: software-mansion/setup-scarb@v1 with: - scarb-version: "0.7.0" + scarb-version: 0.7.0 - name: Generate gas snapshot run: python scripts/gen_snapshot.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41ae4d97f..c52c78e42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: CI +permissions: read-all + on: [pull_request] jobs: @@ -9,7 +11,7 @@ jobs: - uses: actions/checkout@v3 - uses: software-mansion/setup-scarb@v1 with: - scarb-version: "0.7.0" + scarb-version: 0.7.0 - run: scarb fmt --check - run: scarb build - run: scarb test diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml new file mode 100644 index 000000000..2e0216311 --- /dev/null +++ b/.github/workflows/trunk-check.yml @@ -0,0 +1,24 @@ +name: Trunk + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: read-all + +jobs: + trunk_check: + name: Trunk Check Runner + runs-on: ubuntu-latest + permissions: + checks: write # For trunk to post annotations + contents: read # For repo checkout + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Trunk Check + uses: trunk-io/trunk-action@v1 diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 000000000..1e2465290 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,8 @@ +*out +*logs +*actions +*notifications +*tools +plugins +user_trunk.yaml +user.yaml diff --git a/.trunk/configs/.isort.cfg b/.trunk/configs/.isort.cfg new file mode 100644 index 000000000..b9fb3f3e8 --- /dev/null +++ b/.trunk/configs/.isort.cfg @@ -0,0 +1,2 @@ +[settings] +profile=black diff --git a/.trunk/configs/.shellcheckrc b/.trunk/configs/.shellcheckrc new file mode 100644 index 000000000..8c7b1ada8 --- /dev/null +++ b/.trunk/configs/.shellcheckrc @@ -0,0 +1,7 @@ +enable=all +source-path=SCRIPTDIR +disable=SC2154 + +# If you're having issues with shellcheck following source, disable the errors via: +# disable=SC1090 +# disable=SC1091 diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml new file mode 100644 index 000000000..4d444662d --- /dev/null +++ b/.trunk/configs/.yamllint.yaml @@ -0,0 +1,10 @@ +rules: + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + key-duplicates: {} + octal-values: + forbid-implicit-octal: true diff --git a/.trunk/configs/ruff.toml b/.trunk/configs/ruff.toml new file mode 100644 index 000000000..346b1d9aa --- /dev/null +++ b/.trunk/configs/ruff.toml @@ -0,0 +1,5 @@ +# Generic, formatter-friendly config. +select = ["B", "D3", "D4", "E", "F"] + +# Never enforce `E501` (line length violations). This should be handled by formatters. +ignore = ["E501"] diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 000000000..741832740 --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,40 @@ +# This file controls the behavior of Trunk: https://docs.trunk.io/cli +# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml +version: 0.1 +cli: + version: 1.16.0 +plugins: + sources: + - id: trunk + ref: v1.2.3 + uri: https://github.com/trunk-io/plugins +runtimes: + enabled: + - go@1.21.0 + - node@18.12.1 + - python@3.10.8 +lint: + enabled: + - actionlint@1.6.25 + - bandit@1.7.5 + - black@23.9.1 + - checkov@2.4.9 + - git-diff-check + - isort@5.12.0 + - markdownlint@0.36.0 + - oxipng@8.0.0 + - prettier@3.0.3 + - ruff@0.0.290 + - shellcheck@0.9.0 + - shfmt@3.6.0 + - taplo@0.8.1 + - trivy@0.45.1 + - trufflehog@3.56.1 + - yamllint@1.32.0 +actions: + disabled: + - trunk-announce + - trunk-check-pre-push + - trunk-fmt-pre-commit + enabled: + - trunk-upgrade-available