Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Dec 16, 2024
1 parent 3e3bcfa commit acef18d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
55 changes: 30 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ jobs:
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh

- name: run the build
# - name: run the build
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
run: src/ci/scripts/run-build-from-ci.sh 2>&1
env:
AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
# run: src/ci/scripts/run-build-from-ci.sh 2>&1
# env:
# AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}

- name: create github artifacts
run: src/ci/scripts/create-doc-artifacts.sh
Expand All @@ -207,26 +207,26 @@ jobs:
echo "disk usage:"
df -h
- name: upload artifacts to github
uses: actions/upload-artifact@v4
with:
# name is set in previous step
name: ${{ env.DOC_ARTIFACT_NAME }}
path: obj/artifacts/doc
if-no-files-found: ignore
retention-days: 5

- name: upload artifacts to S3
run: src/ci/scripts/upload-artifacts.sh
env:
AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
# Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
# builders *should* have the AWS credentials available. Still, explicitly
# adding the condition is helpful as this way CI will not silently skip
# deploying artifacts from a dist builder if the variables are misconfigured,
# erroring about invalid credentials instead.
if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
# - name: upload artifacts to github
# uses: actions/upload-artifact@v4
# with:
# # name is set in previous step
# name: ${{ env.DOC_ARTIFACT_NAME }}
# path: obj/artifacts/doc
# if-no-files-found: ignore
# retention-days: 5
#
# - name: upload artifacts to S3
# run: src/ci/scripts/upload-artifacts.sh
# env:
# AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
# # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
# # builders *should* have the AWS credentials available. Still, explicitly
# # adding the condition is helpful as this way CI will not silently skip
# # deploying artifacts from a dist builder if the variables are misconfigured,
# # erroring about invalid credentials instead.
# if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'

- name: upload job metrics to DataDog
if: needs.calculate_matrix.outputs.run_type != 'pr'
Expand All @@ -237,6 +237,11 @@ jobs:
run: |
cd src/ci
npm ci
which npx || exit 0
where npx || exit 0
which datadog-ci || exit 0
where datadog-ci || exit 0
npm root -g
python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv
# This job isused to tell bors the final status of the build, as there is no practical way to detect
Expand Down
10 changes: 9 additions & 1 deletion src/ci/scripts/upload-build-metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

import argparse
import csv
import os
import subprocess
import sys
from pathlib import Path
from typing import List

Expand All @@ -48,8 +50,14 @@ def upload_datadog_measure(name: str, value: float):
"""
print(f"Metric {name}: {value:.4f}")

cmd = "npx"
if os.getenv("GITHUB_ACTIONS") is not None and sys.platform.lower().startswith("win"):
# Due to weird interaction of MSYS2 and Python, we need to use an absolute path,
# and also specify the ".cmd" at the end. See https://github.com/rust-lang/rust/pull/125771.
cmd = "C:\\npm\\prefix\\npx.cmd"

subprocess.run(
["npx", "datadog-ci", "measure", "--level", "job", "--measures", f"{name}:{value}"],
[cmd, "datadog-ci", "measure", "--level", "job", "--measures", f"{name}:{value}"],
check=False,
)

Expand Down

0 comments on commit acef18d

Please sign in to comment.