diff --git a/.aspect/workflows/config.yaml b/.aspect/workflows/config.yaml index e406bca..a3654a6 100644 --- a/.aspect/workflows/config.yaml +++ b/.aspect/workflows/config.yaml @@ -1,4 +1,3 @@ ---- queue: bazel-lib-default workspaces: .: diff --git a/.circleci/user-config.yml b/.circleci/user-config.yml index f9cf524..a11cf53 100644 --- a/.circleci/user-config.yml +++ b/.circleci/user-config.yml @@ -32,7 +32,6 @@ # `aspect-workflows-` and job names prefixed with `aw-`. Conflicting workflow or # job names will result in a bad configuration merge. version: 2.1 - jobs: user-job: docker: @@ -40,7 +39,6 @@ jobs: steps: - checkout - run: echo "Example user CircleCI job that is not generated by Aspect Workflows." - workflows: user-workflow: jobs: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 55b1859..d9f2495 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,4 @@ name: CI - # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the main branch @@ -7,16 +6,13 @@ on: branches: [main, 1.x] pull_request: branches: [main, 1.x] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - concurrency: # Cancel previous actions from the same PR or branch except 'main' branch. # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} cancel-in-progress: ${{ github.ref_name != 'main' }} - jobs: # Prepares dynamic test matrix values matrix-prep: @@ -66,7 +62,6 @@ jobs: bazel-version: ${{ steps.bazel-version.outputs.res }} config: ${{ steps.config.outputs.res }} os: ${{ steps.os.outputs.res }} - test: runs-on: ${{ matrix.os }}-latest needs: @@ -120,10 +115,8 @@ jobs: os: macos - folder: . os: windows - steps: - uses: actions/checkout@v4 - - name: Mount bazel caches uses: actions/cache@v4 with: @@ -132,7 +125,6 @@ jobs: ~/.cache/bazel-repository-cache key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }} restore-keys: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}- - - name: Configure Bazel version working-directory: ${{ matrix.folder }} shell: bash @@ -146,7 +138,6 @@ jobs: # root .bazelrc brings these in with try-imports. In this CI workflows, we explicitly # bring in the version specific bazelrc file with --bazelrc when we invoke bazel. rm ${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/local/*.bazelrc - - name: Write rbe credentials if: ${{ matrix.config == 'rbe' }} working-directory: ${{ matrix.folder }} @@ -156,14 +147,12 @@ jobs: echo "build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > $HOME/.bazelrc env: BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} - # TODO: remove this block once we have Aspect CLI Windows releases - name: Don't use Aspect CLI on Windows if: matrix.os == 'windows' working-directory: ${{ matrix.folder }} shell: bash run: rm -f .bazeliskrc - - name: bazel test //... working-directory: ${{ matrix.folder }} shell: bash @@ -178,13 +167,11 @@ jobs: --build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \ --enable_bzlmod=${{ matrix.bzlmod }} \ //... - - name: Integration tests # Don't run integration tests on Windows since they are bash scripts and Windows runs Powershell if: matrix.folder == '.' && matrix.os != 'windows' && matrix.bazel-version.major != '6' # Find all shell scripts within e2e, echo the filename, execute, fail on error run: find e2e/*.sh -maxdepth 1 -type f -exec sh -c 'echo "\n\n------------------------------- $0 -------------------------------" && BZLMOD_FLAG=${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} "$0" || kill $PPID' \{\} \; - - name: Verify bcr patches if: matrix.folder == '.' && matrix.bzlmod == '1' && matrix.os == 'ubuntu' && matrix.bazel-version.major != '6' run: patch --dry-run -p1 < .bcr/patches/*.patch diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 617d867..75b2868 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -1,15 +1,12 @@ name: Verify PR title/description - on: pull_request_target: types: - opened - edited - synchronize - permissions: pull-requests: read - jobs: check: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f04d023..52b7a81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,12 +2,10 @@ # You should use an annotated tag, like `git tag -a v1.2.3` # and put the release notes into the commit message for the tag. name: Release - on: push: tags: - "v*.*.*" - jobs: build: # Go cross-compilation works from linux -> any platform @@ -28,7 +26,6 @@ jobs: name: artifacts path: artifacts/ retention-days: 1 - release: needs: build runs-on: ubuntu-latest @@ -37,10 +34,8 @@ jobs: # Fetch the built artifacts from build jobs above and extract into # ${GITHUB_WORKSPACE}/artifacts/* - uses: actions/download-artifact@v4 - - name: Prepare workspace snippet run: .github/workflows/release_prep.sh > release_notes.txt - - uses: softprops/action-gh-release@v2 with: # Use GH feature to populate the changelog automatically diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55ce95b..8720965 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,6 @@ # Commitizen runs in commit-msg stage # but we don't want to run the other hooks on commit messages default_stages: [commit] - repos: # Check formatting and lint for starlark code - repo: https://github.com/keith/pre-commit-buildifier diff --git a/e2e/smoke/basic.bats b/e2e/smoke/basic.bats index 03d254c..97dac55 100644 --- a/e2e/smoke/basic.bats +++ b/e2e/smoke/basic.bats @@ -2,7 +2,6 @@ bats_load_library "bats-support" bats_load_library "bats-assert" @test 'basic' { - run echo 'have' - assert_output 'have' + run echo 'have' + assert_output 'have' } - diff --git a/lib/tests/bats/additional_lib.bats b/lib/tests/bats/additional_lib.bats index 5d1438d..8846af2 100644 --- a/lib/tests/bats/additional_lib.bats +++ b/lib/tests/bats/additional_lib.bats @@ -3,6 +3,5 @@ bats_load_library 'bats-assert' bats_load_library 'bats-custom' @test 'env' { - run custom_test_fn + run custom_test_fn } - diff --git a/lib/tests/bats/basic.bats b/lib/tests/bats/basic.bats index ded6a23..83f46c9 100644 --- a/lib/tests/bats/basic.bats +++ b/lib/tests/bats/basic.bats @@ -2,7 +2,6 @@ bats_load_library 'bats-support' bats_load_library 'bats-assert' @test 'assert_output() check for existence' { - run echo 'have' - assert_output 'have' + run echo 'have' + assert_output 'have' } - diff --git a/lib/tests/bats/env.bats b/lib/tests/bats/env.bats index c5f8689..0a432db 100644 --- a/lib/tests/bats/env.bats +++ b/lib/tests/bats/env.bats @@ -2,7 +2,6 @@ bats_load_library 'bats-support' bats_load_library 'bats-assert' @test 'env' { - run echo $USE_BAZEL_VERSION - assert_output 'latest' + run echo $USE_BAZEL_VERSION + assert_output 'latest' } - diff --git a/lib/tests/bats/env_expansion.bats b/lib/tests/bats/env_expansion.bats index b9b55bd..5d690d7 100644 --- a/lib/tests/bats/env_expansion.bats +++ b/lib/tests/bats/env_expansion.bats @@ -3,8 +3,7 @@ bats_load_library 'bats-assert' bats_load_library 'bats-file' @test 'env expansion' { - run echo $DATA_PATH - assert_output 'lib/tests/bats/data.bin' - assert_file_exists 'lib/tests/bats/data.bin' + run echo $DATA_PATH + assert_output 'lib/tests/bats/data.bin' + assert_file_exists 'lib/tests/bats/data.bin' } - diff --git a/tools/common/clonefile_darwin.go b/tools/common/clonefile_darwin.go index fff7776..9cae222 100644 --- a/tools/common/clonefile_darwin.go +++ b/tools/common/clonefile_darwin.go @@ -3,8 +3,9 @@ package common import ( - "golang.org/x/sys/unix" "os" + + "golang.org/x/sys/unix" ) // https://keith.github.io/xcode-man-pages/clonefile.2.html diff --git a/tools/copy_directory/main.go b/tools/copy_directory/main.go index 2b9fba6..b3ad316 100644 --- a/tools/copy_directory/main.go +++ b/tools/copy_directory/main.go @@ -13,10 +13,12 @@ import ( type pathSet map[string]bool -var srcPaths = pathSet{} -var hardlink = false -var verbose = false -var preserveMTime = false +var ( + srcPaths = pathSet{} + hardlink = false + verbose = false + preserveMTime = false +) type walker struct { queue chan<- common.CopyOpts diff --git a/tools/copy_to_directory/main.go b/tools/copy_to_directory/main.go index c578504..b8f8638 100644 --- a/tools/copy_to_directory/main.go +++ b/tools/copy_to_directory/main.go @@ -47,11 +47,15 @@ type config struct { TargetWorkspace *string } -type copyMap map[string]fileInfo -type pathSet map[string]bool +type ( + copyMap map[string]fileInfo + pathSet map[string]bool +) -var copySet = copyMap{} -var mkdirSet = pathSet{} +var ( + copySet = copyMap{} + mkdirSet = pathSet{} +) func parseConfig(configPath string, wkspName *string) (*config, error) { f, err := os.Open(configPath) diff --git a/tools/expand_template/main.go b/tools/expand_template/main.go index 73fa284..6119c1c 100644 --- a/tools/expand_template/main.go +++ b/tools/expand_template/main.go @@ -60,9 +60,9 @@ func main() { content = strings.ReplaceAll(content, key, value) } - var mode os.FileMode = 0666 + var mode os.FileMode = 0o666 if executable { - mode = 0777 + mode = 0o777 } err = os.WriteFile(args[1], []byte(content), mode) if err != nil { @@ -89,5 +89,4 @@ func parseStatusFile(statusFilePath string) (map[string]string, error) { } return results, nil - } diff --git a/tools/format/BUILD.bazel b/tools/format/BUILD.bazel index 21b2f96..2b41075 100644 --- a/tools/format/BUILD.bazel +++ b/tools/format/BUILD.bazel @@ -2,11 +2,10 @@ load("@aspect_rules_lint//format:defs.bzl", "format_multirun") format_multirun( name = "format", - # TODO: enable formatters in follow-up PR - # go = "@aspect_rules_lint//format:gofumpt", - # shell = "@aspect_rules_lint//format:shfmt", + go = "@aspect_rules_lint//format:gofumpt", + shell = "@aspect_rules_lint//format:shfmt", starlark = "@buildifier_prebuilt//:buildifier", tags = ["manual"], visibility = ["//:__subpackages__"], - # yaml = "@aspect_rules_lint//format:yamlfmt", + yaml = "@aspect_rules_lint//format:yamlfmt", ) diff --git a/yamlfmt.yaml b/yamlfmt.yaml new file mode 100644 index 0000000..d711491 --- /dev/null +++ b/yamlfmt.yaml @@ -0,0 +1,5 @@ +gitignore_excludes: true +doublestar: true +exclude: + - .circleci/config.yml + - lib/tests/yq/empty.yaml