From a045d26a57679f53a678767a981e615b6ecc5c12 Mon Sep 17 00:00:00 2001 From: seaubot Date: Wed, 13 Sep 2023 20:45:19 +0000 Subject: [PATCH] chore: sync with ecsact_common --- .bazelversion | 1 + .github/workflows/bzlmod-archive.yml | 15 ++++++++++ .github/workflows/main.yml | 43 +++++++++++++++++++++++----- bazel/common.bazelrc | 17 +++++++++++ bazel/copts.bzl | 16 +++++++++-- cog.toml | 11 +++++++ renovate.json | 2 +- 7 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 .bazelversion create mode 100644 .github/workflows/bzlmod-archive.yml create mode 100644 bazel/common.bazelrc create mode 100644 cog.toml diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000..91e4a9f --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +6.3.2 diff --git a/.github/workflows/bzlmod-archive.yml b/.github/workflows/bzlmod-archive.yml new file mode 100644 index 0000000..32613e3 --- /dev/null +++ b/.github/workflows/bzlmod-archive.yml @@ -0,0 +1,15 @@ +# This file is maintained by ecsact-dev/ecsact_common +# If changes are required please make them there + +name: bzlmod archive + +on: + release: + types: [published] + +jobs: + bzlmod-archive: + uses: ecsact-dev/bazel_registry/.github/workflows/bzlmod-archive.yml@main + secrets: inherit + permissions: + contents: write diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 354e4bb..1a281a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,19 +1,48 @@ -name: CI +# This file is maintained by ecsact-dev/ecsact_common +# If changes are required please make them there + +name: main on: push: branches: - "**" -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - jobs: formatting-check: name: Formatting Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: jidicula/clang-format-action@v4.9.0 - with: { clang-format-version: "15" } + with: { clang-format-version: "16" } + + test-windows: + runs-on: windows-latest + steps: + - uses: actions/cache@v3 + with: + path: | + /Users/runneradmin/AppData/Local/bazelisk + /Users/runneradmin/.cache/bazel-disk-cache + key: ${{runner.os}}-bazel-cache + - uses: actions/checkout@v4 + - run: bazelisk build --config=ci //... + - if: ${{ hashfiles('test/MODULE.bazel') != '' }} + run: bazelisk test --config=ci ... + working-directory: test + + test-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/cache@v3 + with: + path: | + ~/.cache/bazelisk + ~/.cache/bazel-disk-cache + key: ${{runner.os}}-bazel-cache + - uses: actions/checkout@v4 + - run: bazelisk build --config=ci //... + - if: ${{ hashfiles('test/MODULE.bazel') != '' }} + run: bazelisk test --config=ci ... + working-directory: test diff --git a/bazel/common.bazelrc b/bazel/common.bazelrc new file mode 100644 index 0000000..0b43bbe --- /dev/null +++ b/bazel/common.bazelrc @@ -0,0 +1,17 @@ +startup --windows_enable_symlinks +common --enable_bzlmod +build --enable_platform_specific_config +build --incompatible_use_platforms_repo_for_constraints +build --incompatible_enable_cc_toolchain_resolution +build --incompatible_strict_action_env +build --enable_runfiles +build --noincompatible_remove_rule_name_parameter +query --noincompatible_remove_rule_name_parameter + +# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged +build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux + +common:ci --announce_rc +common:ci --verbose_failures +common:ci --keep_going +common:ci --disk_cache=~/.cache/bazel-disk-cache diff --git a/bazel/copts.bzl b/bazel/copts.bzl index 8f5e387..8ddeb95 100644 --- a/bazel/copts.bzl +++ b/bazel/copts.bzl @@ -1,4 +1,14 @@ -copts = select({ - "@bazel_tools//tools/cpp:msvc": ["/std:c++latest", "/Zc:preprocessor", "/permissive-"], - "//conditions:default": ["-std=c++20"], +load("@bazel_skylib//lib:selects.bzl", "selects") + +# Ecsact repositories currently only support clang and cl +copts = selects.with_or({ + ("@rules_cc//cc/compiler:clang"): [ + "-std=c++2b", + "-fexperimental-library", + ], + ("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [ + "/std:c++latest", + "/permissive-", + "/Zc:preprocessor", + ], }) diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..15631fc --- /dev/null +++ b/cog.toml @@ -0,0 +1,11 @@ +pre_bump_hooks = [ + "buildozer 'set version {{version}}' //MODULE.bazel:%module", + # Ecsact pre 1.0.0 the 0.X.0 is our 'major' version + "buildozer 'set compatibility_level {{version.minor}}' //MODULE.bazel:%module", +] + +post_bump_hooks = [ + "git push", + "git push origin {{version}}", + "gh release create {{version}} --generate-notes --latest -t {{version}} --verify-tag", +] diff --git a/renovate.json b/renovate.json index 25b1be3..fa1abeb 100644 --- a/renovate.json +++ b/renovate.json @@ -3,4 +3,4 @@ "extends": [ "github>ecsact-dev/renovate-config" ] -} +} \ No newline at end of file