From b9ea497b566c09f5f0fc656c361fdea590672ea6 Mon Sep 17 00:00:00 2001 From: Akseli Lukkarila Date: Fri, 12 Jan 2024 11:32:09 +0200 Subject: [PATCH] run formatting checks only when needed --- .github/workflows/black.yml | 3 +++ .github/workflows/cargo.yml | 25 ++++++++++++++++++++----- .github/workflows/go.yml | 3 +++ .github/workflows/isort.yml | 3 +++ .github/workflows/pip.yml | 3 +++ .github/workflows/ruff.yml | 3 +++ 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 658b9e18..b8a6c6ac 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -13,6 +13,9 @@ on: branches: - master - main + paths: + - "**.py" + - ".github/workflows/black.yml" # https://github.com/psf/black jobs: diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index b60001ea..8e6e2fa3 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -16,6 +16,9 @@ on: - master - main +env: + CARGO_TERM_COLOR: always + # https://github.com/actions-rs/cargo jobs: cargo: @@ -30,17 +33,29 @@ jobs: with: workspaces: ./rust -> target + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: build + working-directory: rust + run: cargo build + - name: fmt working-directory: rust - # workaround for color output - env: - TERM: xterm-256color run: cargo fmt --check --verbose - name: clippy working-directory: rust - env: - TERM: xterm-256color # exit non-zero if there are any warnings # https://doc.rust-lang.org/stable/clippy/usage.html run: cargo clippy -- -Dwarnings diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6658ead1..addc8584 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -29,9 +29,12 @@ jobs: with: go-version: "1.21.x" cache-dependency-path: go/go.sum + - name: Install dependencies run: go get . + - name: Build run: go build -v ./... + - name: Test with the Go CLI run: go test diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index abea9de4..401456d9 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -13,6 +13,9 @@ on: branches: - master - main + paths: + - "**.py" + - ".github/workflows/isort.yml" # https://github.com/marketplace/actions/python-isort jobs: diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 90b486d8..72bc0b34 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -13,6 +13,9 @@ on: branches: - master - main + paths: + - "python/requirements.txt" + - ".github/workflows/pip.yml" # https://github.com/py-actions/py-dependency-install jobs: diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 43cc0654..309f20af 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -13,6 +13,9 @@ on: branches: - master - main + paths: + - "**.py" + - ".github/workflows/ruff.yml" # https://github.com/chartboost/ruff-action jobs: