|
7 | 7 | push: |
8 | 8 | branches: [main] |
9 | 9 |
|
| 10 | +permissions: |
| 11 | + actions: read |
| 12 | + contents: read |
| 13 | + |
10 | 14 | concurrency: |
11 | 15 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
12 | 16 | cancel-in-progress: true |
|
58 | 62 | uv venv .venv |
59 | 63 | uv pip install -e .[dev] |
60 | 64 |
|
| 65 | + - name: Resolve compatible lbug artifact run |
| 66 | + working-directory: ladybug |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ github.token }} |
| 69 | + run: | |
| 70 | + SHA="$(git rev-parse HEAD)" |
| 71 | + API_URL="https://api.github.com/repos/LadybugDB/ladybug/actions/workflows/build-and-deploy.yml/runs" |
| 72 | + AUTH_HEADER="Authorization: Bearer $GITHUB_TOKEN" |
| 73 | + ACCEPT_HEADER="Accept: application/vnd.github+json" |
| 74 | + VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28" |
| 75 | +
|
| 76 | + RUN_ID="$( |
| 77 | + curl -fsSL \ |
| 78 | + -H "$AUTH_HEADER" \ |
| 79 | + -H "$ACCEPT_HEADER" \ |
| 80 | + -H "$VERSION_HEADER" \ |
| 81 | + "$API_URL?head_sha=$SHA&status=success&per_page=1" \ |
| 82 | + | python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")' |
| 83 | + )" |
| 84 | +
|
| 85 | + if [ -z "$RUN_ID" ]; then |
| 86 | + RUN_ID="$( |
| 87 | + curl -fsSL \ |
| 88 | + -H "$AUTH_HEADER" \ |
| 89 | + -H "$ACCEPT_HEADER" \ |
| 90 | + -H "$VERSION_HEADER" \ |
| 91 | + "$API_URL?branch=main&status=success&per_page=1" \ |
| 92 | + | python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")' |
| 93 | + )" |
| 94 | + fi |
| 95 | +
|
| 96 | + if [ -z "$RUN_ID" ]; then |
| 97 | + echo "Could not find a successful LadybugDB/ladybug build-and-deploy run." >&2 |
| 98 | + exit 1 |
| 99 | + fi |
| 100 | +
|
| 101 | + echo "Using Ladybug build-and-deploy RUN_ID=$RUN_ID for SHA=$SHA" |
| 102 | + echo "LBUG_BUILD_RUN_ID=$RUN_ID" >> "$GITHUB_ENV" |
| 103 | +
|
| 104 | + - name: Download shared lbug library |
| 105 | + working-directory: ladybug/tools/python_api |
| 106 | + env: |
| 107 | + GH_TOKEN: ${{ github.token }} |
| 108 | + run: | |
| 109 | + gh --version |
| 110 | + LBUG_PRECOMPILED_RUN_ID="$LBUG_BUILD_RUN_ID" LBUG_LIB_KIND=shared bash scripts/download_lbug.sh .cache/lbug-capi.env |
| 111 | + cat .cache/lbug-capi.env >> "$GITHUB_ENV" |
| 112 | +
|
61 | 113 | - name: Check formatting (black) |
62 | 114 | working-directory: ladybug/tools/python_api |
63 | 115 | run: | |
|
0 commit comments