Paul Jolly | 5b3d551 | 2021-02-01 14:33:07 +0000 | [diff] [blame] | 1 | // Copyright 2021 The CUE Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 15 | // package github declares the workflows for this project. |
Paul Jolly | 2795dcc | 2022-05-29 05:54:34 +0100 | [diff] [blame] | 16 | package github |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 17 | |
| 18 | import ( |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 19 | "cuelang.org/go/internal/ci/base" |
| 20 | "cuelang.org/go/internal/ci/gerrithub" |
| 21 | |
Paul Jolly | 78cc785 | 2020-05-28 05:12:18 +0100 | [diff] [blame] | 22 | "github.com/SchemaStore/schemastore/src/schemas/json" |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 23 | ) |
| 24 | |
Paul Jolly | c3f30d8 | 2020-08-19 11:41:46 +0100 | [diff] [blame] | 25 | workflows: [...{file: string, schema: (json.#Workflow & {})}] |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 26 | workflows: [ |
| 27 | { |
Paul Jolly | f28ad41 | 2022-07-06 17:31:37 +0100 | [diff] [blame] | 28 | // Note: the name of the file corresponds to the environment variable |
| 29 | // names for gerritstatusupdater. Therefore, this filename must only be |
| 30 | // change in combination with also updating the environment in which |
| 31 | // gerritstatusupdater is running for this repository. |
Paul Jolly | d4526fe | 2022-07-11 11:07:21 +0100 | [diff] [blame] | 32 | file: "trybot.yml" |
| 33 | schema: trybot |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 34 | }, |
| 35 | { |
Paul Jolly | d4526fe | 2022-07-11 11:07:21 +0100 | [diff] [blame] | 36 | file: "trybot_dispatch.yml" |
| 37 | schema: trybot_dispatch |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 38 | }, |
| 39 | { |
| 40 | file: "release.yml" |
| 41 | schema: release |
| 42 | }, |
| 43 | { |
Paul Jolly | 6c6b4e7 | 2021-04-29 16:12:04 +0100 | [diff] [blame] | 44 | file: "tip_triggers.yml" |
| 45 | schema: tip_triggers |
| 46 | }, |
Paul Jolly | 65163a0 | 2020-05-16 07:48:35 +0100 | [diff] [blame] | 47 | ] |
| 48 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 49 | // TODO: _#repositoryURL and _#unityURL should be extracted from codereview.cfg |
| 50 | _#repositoryURL: "https://github.com/cue-lang/cue" |
| 51 | _#unityURL: "https://github.com/cue-unity/unity" |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 52 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 53 | _#defaultBranch: "master" |
| 54 | _#releaseTagPattern: "v*" |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 55 | |
Daniel Martí | dc2c9e0 | 2022-04-09 17:03:59 +0900 | [diff] [blame] | 56 | // Use the latest Go version for extra checks, |
| 57 | // such as running tests with the data race detector. |
| 58 | _#latestStableGo: "1.18.x" |
| 59 | |
| 60 | // Use a specific latest version for release builds. |
| 61 | // Note that we don't want ".x" for the sake of reproducibility, |
| 62 | // so we instead pin a specific Go release. |
| 63 | _#pinnedReleaseGo: "1.18.1" |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 64 | |
Daniel Martí | db3e6ac | 2022-04-26 11:37:35 +0100 | [diff] [blame] | 65 | _#linuxMachine: "ubuntu-20.04" |
| 66 | _#macosMachine: "macos-11" |
| 67 | _#windowsMachine: "windows-2022" |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 68 | |
Daniel Martí | 395df20 | 2022-08-01 10:01:20 +0100 | [diff] [blame] | 69 | // #_isLatestLinux evaluates to true if the job is running on Linux with the |
| 70 | // latest version of Go. This expression is often used to run certain steps |
| 71 | // just once per CI workflow, to avoid duplicated work. |
| 72 | #_isLatestLinux: "matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)'" |
| 73 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 74 | _#goreleaserVersion: "v1.8.2" |
| 75 | |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 76 | _#testStrategy: { |
| 77 | "fail-fast": false |
| 78 | matrix: { |
Daniel Martí | bd9ae53 | 2022-05-05 13:44:26 +0100 | [diff] [blame] | 79 | "go-version": ["1.17.x", _#latestStableGo] |
Paul Jolly | 7d25ee2 | 2021-07-15 17:49:42 +0100 | [diff] [blame] | 80 | os: [_#linuxMachine, _#macosMachine, _#windowsMachine] |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 84 | // _gerrithub is an instance of ./gerrithub, parameterised by the properties of |
| 85 | // this project |
| 86 | _gerrithub: gerrithub & { |
| 87 | #repositoryURL: _#repositoryURL |
| 88 | #botGitHubUser: "cueckoo" |
| 89 | #botGitHubUserTokenSecretsKey: "CUECKOO_GITHUB_PAT" |
| 90 | #botGitHubUserEmail: "cueckoo@gmail.com" |
| 91 | #botGerritHubUser: #botGitHubUser |
| 92 | #botGerritHubUserPasswordSecretsKey: "CUECKOO_GERRITHUB_PASSWORD" |
| 93 | #botGerritHubUserEmail: #botGitHubUserEmail |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 94 | } |
| 95 | |
Paul Jolly | 236a565 | 2022-06-29 11:29:47 +0100 | [diff] [blame] | 96 | // _base is an instance of ./base, parameterised by the properties of this |
| 97 | // project |
| 98 | // |
| 99 | // TODO: revisit the naming strategy here. _base and base are very similar. |
| 100 | // Perhaps rename the import to something more obviously not intended to be |
| 101 | // used, and then rename the field base? |
| 102 | _base: base & { |
| 103 | #repositoryURL: "https://github.com/cue-lang/cue" |
| 104 | #defaultBranch: _#defaultBranch |
| 105 | #botGitHubUser: "cueckoo" |
| 106 | #botGitHubUserTokenSecretsKey: "CUECKOO_GITHUB_PAT" |
Paul Jolly | ccbfbd2 | 2021-01-14 17:50:29 +0000 | [diff] [blame] | 107 | } |