mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
Start adding CICD config
This commit is contained in:
parent
2bf530588e
commit
760106bcd5
2 changed files with 173 additions and 0 deletions
38
.github/workflows/bazel_example.yaml
vendored
Normal file
38
.github/workflows/bazel_example.yaml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
ci_bazel:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/bazel
|
||||
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bazel-
|
||||
|
||||
- name: update packages
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: install other system dependencies
|
||||
run: sudo apt-get -y install pkg-config libssl-dev default-jre pkgconf
|
||||
|
||||
- name: Bazel Build
|
||||
run: bazelisk build --config=ci //...
|
||||
|
||||
- name: Upload bazel-explain build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bazel-explain-build-run
|
||||
path: bazel-explain.log
|
||||
|
||||
- name: Bazel Test
|
||||
run: bazelisk test //... --config=ci --test_output=all --test_arg=--nocapture
|
||||
|
||||
- name: Upload bazel-explain test artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bazel-explain-test-run
|
||||
path: bazel-explain.log
|
135
examples/bazel_build/.bazelrc
Normal file
135
examples/bazel_build/.bazelrc
Normal file
|
@ -0,0 +1,135 @@
|
|||
###########
|
||||
# General #
|
||||
###########
|
||||
|
||||
# A config file containing Bazel settings
|
||||
common --enable_bzlmod
|
||||
|
||||
# https://github.com/bazelbuild/bazel/pull/20855
|
||||
common --noenable_workspace
|
||||
|
||||
###########
|
||||
# Caching #
|
||||
###########
|
||||
|
||||
# Use BLAKE3 as digest function (will be the default in Bazel 8)
|
||||
startup --digest_function=BLAKE3
|
||||
|
||||
# Always have Bazel output why it (re)built something, should make debugging builds easier.
|
||||
# This has a small performance penalty. If builds become slow, we might want to try and turn this off.
|
||||
common --explain=bazel-explain.log
|
||||
common --verbose_explanations
|
||||
|
||||
# This adds another folder with a cache specific to this project
|
||||
# In case some rust source files are not generated, try commenting this out and building again.
|
||||
common --disk_cache=~/.cache/bazel_disk_cache
|
||||
build --disk_cache=~/.cache/bazel_disk_cache
|
||||
fetch --disk_cache=~/.cache/bazel_disk_cache
|
||||
query --disk_cache=~/.cache/bazel_disk_cache
|
||||
sync --disk_cache=~/.cache/bazel_disk_cache
|
||||
test --disk_cache=~/.cache/bazel_disk_cache
|
||||
# Note that this cache will grow without bound currently. You should
|
||||
# Periodically run `find "~/.cache/bazel_disk_cache" -type f -atime +30 -delete`
|
||||
# https://github.com/bazelbuild/bazel/issues/5139 tracks fixing this issue.
|
||||
|
||||
# Compresses remote cache for files larger than 100MB
|
||||
# NOTE: disk_cache is a local version of remote cache
|
||||
common:workflows --remote_cache_compression
|
||||
common:workflows --experimental_remote_cache_compression_threshold=100
|
||||
|
||||
#########
|
||||
# Build #
|
||||
#########
|
||||
|
||||
# Don't use legacy toolchain resolution
|
||||
common --incompatible_enable_cc_toolchain_resolution
|
||||
common --incompatible_enable_proto_toolchain_resolution
|
||||
|
||||
# Don't leak PATH and LD_LIBRARY_PATH into the build.
|
||||
build --incompatible_strict_action_env
|
||||
|
||||
build --sandbox_default_allow_network=true # re-enabled to allow skia-bindings to download
|
||||
build --heap_dump_on_oom
|
||||
build --noexperimental_check_output_files
|
||||
|
||||
# Add build annotation for clippy and rustfmt by default.
|
||||
# build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
|
||||
# build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
|
||||
|
||||
build:nightly --@rules_rust//rust/toolchain/channel=nightly
|
||||
|
||||
#################
|
||||
# Rust-analyzer #
|
||||
#################
|
||||
|
||||
run:genra @rules_rust//tools/rust_analyzer:gen_rust_project
|
||||
|
||||
##############
|
||||
# Formatting #
|
||||
##############
|
||||
|
||||
# Apply formatting to all files
|
||||
run:rustfmt @rules_rust//:rustfmt --output_groups=+rustfmt_checks --@rules_rust//:rustfmt.toml=//:rustfmt.toml
|
||||
|
||||
# Check whether formatting has been applied correctly
|
||||
build:rustfmt --output_groups=+rustfmt_checks --@rules_rust//:rustfmt.toml=//:rustfmt.toml
|
||||
|
||||
###########
|
||||
# Linting #
|
||||
###########
|
||||
|
||||
# Causes rustc to emit .rmeta files and use them for rlib -> rlib dependencies
|
||||
# See https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199
|
||||
build:check --@rules_rust//rust/settings:pipelined_compilation=True
|
||||
|
||||
# Ignores all outputs other than `.rmeta`, requires pipelined_compilation to be enabled!
|
||||
build:check --output_groups=build_metadata
|
||||
|
||||
# Linting with Clippy (stricter than build without options)
|
||||
# This does not work with the option `pipelined_compilation` on all modules
|
||||
build:clippy --output_groups=+clippy_checks
|
||||
|
||||
# Stricter linting on top of the default checks by Clippy
|
||||
build:pedantic --config=clippy --@rules_rust//:clippy_flags="-Wclippy::pedantic,-Dclippy::perf,-Dclippy::correctness,-Wclippy::suspicious,-Dclippy::complexity,-Dclippy::style,-Aclippy::missing_errors_doc,-Aclippy::missing_panics_doc,-Aclippy::semicolon_if_nothing_returned" --@rules_rust//:clippy.toml=//:clippy.toml
|
||||
|
||||
# Historical shortcut used in an old version of the script in `./rust_analyzer`
|
||||
build:lint_file --@rules_rust//:error_format=json --config=clippy --compile_one_dependency
|
||||
|
||||
##########
|
||||
# Checks #
|
||||
##########
|
||||
|
||||
# Combination of checks by Clippy and Rustfmt
|
||||
build:lint --config=rustfmt --config=clippy
|
||||
|
||||
#############
|
||||
# Debugging #
|
||||
#############
|
||||
|
||||
build:debug -c dbg
|
||||
|
||||
# Expand macros into a file `expanded.rs`
|
||||
build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect
|
||||
build:unpretty --output_groups=+rust_unpretty
|
||||
build:unpretty --config=nightly
|
||||
|
||||
###########
|
||||
# Testing #
|
||||
###########
|
||||
|
||||
test --build_tests_only
|
||||
test:verbose --test_output=all --test_arg=--nocapture
|
||||
|
||||
#########
|
||||
# CI/CD #
|
||||
#########
|
||||
|
||||
common:ci --disk_cache=
|
||||
common:ci --color=yes
|
||||
common:ci --build_metadata=ROLE=CI
|
||||
build:ci --config=lint
|
||||
|
||||
# This import should always be last to allow users to override
|
||||
# Allow user-side customization
|
||||
try-import %workspace%/user.bazelrc
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue