File: build.rcl

package info (click to toggle)
rust-filebuffer 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 180 kB
  • sloc: makefile: 2
file content (87 lines) | stat: -rw-r--r-- 2,196 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// There are a lot of repetitive configuration files for CI and Rustup, we
// deduplicate this using RCL version 0.12.0. <https://github.com/ruuda/rcl>
// Rebuild the files by running `rcl build`.

// The minimum supported Rust version (MSRV).
let msrv = "1.40.0";

// All of the Rust versions that we want to test on CI.
// We pick the MSRV, beta, and some versions in between.
let rust_versions = [msrv, "1.60.0", "1.80", "beta"];

let banner = "# This file is generated from build.rcl.";

// Steps for GitHub Actions job.
let gha_steps = args => [
  { uses = "actions/checkout@v4.2.1" },
  {
    name = "Install toolchain",
    run =
      f"""
      rustup toolchain install {args.rust_version}
      rustup target add {args.target} --toolchain {args.rust_version}
      """,
  },
  {
    name = "Build",
    run = f"cargo +{args.rust_version} build --target {args.target} --verbose",
  },
  {
    name = "Run tests",
    run = f"cargo +{args.rust_version} test --target {args.target} --verbose",
  },
];

let gha_jobs = [
  for rust_version in rust_versions:
  {
    // Dots are not allowed in job names.
    name = f"linux-{rust_version.replace(".", "-")}",
    rust_version = rust_version,
    target = "x86_64-unknown-linux-gnu",
    image = "ubuntu-latest",
  },

  for rust_version in rust_versions:
  for arch in ["x86_64", "i686"]:
  {
    name = f"windows-msvc-{rust_version.replace(".", "-")}-{arch}",
    rust_version = rust_version,
    target = f"{arch}-pc-windows-msvc",
    image = "windows-latest",
  },
];

let github_actions_config = {
  name = "Build",
  on = {
    push = { branches = ["*"] },
    pull_request = { branches = ["master"] },
  },
  env = {
    CARGO_TERM_COLOR = "always",
  },
  jobs = {
    for job in gha_jobs:
    job.name: {
      runs-on = job.image,
      steps = gha_steps(job),
    }
  },
};

{
  ".github/workflows/build.yml": {
    banner = banner,
    format = "json",
    contents = github_actions_config,
  },

  "rust-toolchain.toml": {
    banner = banner,
    format = "toml",
    // For local development, we test with the MSRV by default, to not
    // accidentally break things.
    contents = { toolchain = { channel = msrv } },
  },
}