mirror of
https://github.com/ClementTsang/bottom.git
synced 2024-09-11 03:35:35 +03:00
ci: clean up cirrus CI (#1530)
* ci: try adding auto cancellation back to cirrus tasks
* tweak timeout
* some renaming
* modernizing
* Revert "modernizing"
This reverts commit d66b3aa0e9
.
* hmmm
* bleh back to false
This commit is contained in:
parent
8811d54058
commit
eaff5d009a
@ -42,12 +42,13 @@ env:
|
||||
test_task:
|
||||
auto_cancellation: "false" # We set this to false to prevent nightly builds from affecting this
|
||||
only_if: $CIRRUS_BUILD_SOURCE != "api" && ($CIRRUS_BRANCH == "main" || $CIRRUS_PR != "")
|
||||
timeout_in: "20m"
|
||||
timeout_in: "15m"
|
||||
skip: "!changesInclude('.cargo/**', '.cirrus.yml', 'sample_configs/**', 'src/**', 'tests/**', 'build.rs', 'Cargo.lock', 'Cargo.toml', 'clippy.toml', 'rustfmt.toml')"
|
||||
matrix:
|
||||
- name: "FreeBSD 14 Test"
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0
|
||||
|
||||
- name: "FreeBSD 13 Test"
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-3
|
||||
@ -67,9 +68,9 @@ test_task:
|
||||
- cargo clippy --all-targets --workspace --all-features -- -D warnings
|
||||
<<: *CLEANUP_TEMPLATE
|
||||
|
||||
build_task:
|
||||
release_task:
|
||||
auto_cancellation: "false"
|
||||
only_if: $CIRRUS_BUILD_SOURCE == "api"
|
||||
only_if: $CIRRUS_BUILD_SOURCE == "api" && $BTM_BUILD_RELEASE_CALLER == "ci"
|
||||
timeout_in: "30m"
|
||||
env:
|
||||
BTM_GENERATE: "true"
|
||||
@ -84,6 +85,7 @@ build_task:
|
||||
env:
|
||||
TARGET: "x86_64-unknown-freebsd"
|
||||
NAME: "x86_64-unknown-freebsd-14-0"
|
||||
|
||||
- name: "FreeBSD 13 Build"
|
||||
alias: "freebsd_13_3_build"
|
||||
freebsd_instance:
|
||||
@ -91,6 +93,7 @@ build_task:
|
||||
env:
|
||||
TARGET: "x86_64-unknown-freebsd"
|
||||
NAME: "x86_64-unknown-freebsd-13-3"
|
||||
|
||||
- name: "Legacy Linux (2.17)"
|
||||
alias: "linux_2_17_build"
|
||||
container:
|
||||
|
2
.github/workflows/build_releases.yml
vendored
2
.github/workflows/build_releases.yml
vendored
@ -296,7 +296,7 @@ jobs:
|
||||
raw=$(git branch -r --contains '${{ github.ref_name }}');
|
||||
BRANCH=${raw##*/};
|
||||
fi
|
||||
python ./scripts/cirrus/build.py "$BRANCH" "release/" "${{ inputs.caller }}"
|
||||
python ./scripts/cirrus/release.py "$BRANCH" "release/" "${{ inputs.caller }}"
|
||||
|
||||
- name: Generate artifact attestation for file
|
||||
uses: actions/attest-build-provenance@v1
|
||||
|
2
build.rs
2
build.rs
@ -84,7 +84,7 @@ fn nightly_version() {
|
||||
const ENV_KEY: &str = "BTM_BUILD_RELEASE_CALLER";
|
||||
|
||||
match env::var_os(ENV_KEY) {
|
||||
Some(var) if !var.is_empty() && var == "nightly" => {
|
||||
Some(var) if !var.is_empty() && var == "ci" => {
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
|
||||
if let Some(hash) = extract_sha(option_env!("CIRRUS_CHANGE_IN_REPO")) {
|
||||
|
@ -34,7 +34,9 @@ def make_query_request(key: str, branch: str, build_type: str):
|
||||
|
||||
# Dumb but if it works...
|
||||
config_override = (
|
||||
Path(".cirrus.yml").read_text().replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "nightly"')
|
||||
Path(".cirrus.yml")
|
||||
.read_text()
|
||||
.replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "ci"')
|
||||
)
|
||||
query = """
|
||||
mutation CreateCirrusCIBuild (
|
||||
@ -43,7 +45,7 @@ def make_query_request(key: str, branch: str, build_type: str):
|
||||
$mutation_id: String!,
|
||||
$config_override: String,
|
||||
) {
|
||||
createBuild(
|
||||
createBuild (
|
||||
input: {
|
||||
repositoryId: $repo,
|
||||
branch: $branch,
|
||||
@ -108,7 +110,7 @@ def try_download(build_id: str, dl_path: Path):
|
||||
for task, file in TASKS:
|
||||
url = DL_URL_TEMPLATE % (build_id, task, file)
|
||||
out = os.path.join(dl_path, file)
|
||||
print("Downloading {} to {}".format(file, out))
|
||||
print(f"Downloading {file} to {out}")
|
||||
urlretrieve(url, out)
|
||||
|
||||
|
||||
@ -140,7 +142,7 @@ def main():
|
||||
for i in range(MAX_ATTEMPTS):
|
||||
if success:
|
||||
break
|
||||
print("Attempt {}:".format(i + 1))
|
||||
print(f"Attempt {i + 1}:")
|
||||
|
||||
with urlopen(make_query_request(key, branch, build_type)) as response:
|
||||
response = json.load(response)
|
||||
@ -151,14 +153,14 @@ def main():
|
||||
|
||||
try:
|
||||
build_id = response["data"]["createBuild"]["build"]["id"]
|
||||
print("Created build job {}.".format(build_id))
|
||||
print(f"Created build job {build_id}.")
|
||||
except KeyError:
|
||||
print("There was an issue with creating a build job.")
|
||||
continue
|
||||
|
||||
# First, sleep 4 minutes, as it's unlikely it'll finish before then.
|
||||
SLEEP_MINUTES = 4
|
||||
print("Sleeping for {} minutes.".format(SLEEP_MINUTES))
|
||||
print(f"Sleeping for {SLEEP_MINUTES} minutes.")
|
||||
sleep(60 * SLEEP_MINUTES)
|
||||
print("Mandatory nap over. Starting to check for completion.")
|
||||
|
||||
@ -193,7 +195,7 @@ def main():
|
||||
# Sleep for a minute if something went wrong, just in case.
|
||||
sleep(60)
|
||||
else:
|
||||
print("Build failed to complete after {} minutes, bailing.".format(MINUTES))
|
||||
print(f"Build failed to complete after {MINUTES} minutes, bailing.")
|
||||
|
||||
if not success:
|
||||
exit(2)
|
Loading…
Reference in New Issue
Block a user