Skip to content

Commit 223795b

Browse files
authored
fix(ci): bench scorecard ci windows fixes (#34)
1 parent c55bd5f commit 223795b

2 files changed

Lines changed: 99 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,31 @@ on:
77
branches: [main, dev]
88

99
jobs:
10-
test:
10+
test-pr:
11+
if: github.event_name == 'pull_request'
12+
name: Test (ubuntu-latest)
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: latest
25+
26+
- name: Install dependencies
27+
run: bun install
28+
29+
- name: Run tests
30+
# Fast PR validation on Linux only.
31+
run: bun test test/
32+
33+
test-merge:
34+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
1135
name: Test (${{ matrix.os }})
1236
runs-on: ${{ matrix.os }}
1337
strategy:
@@ -30,7 +54,5 @@ jobs:
3054
run: bun install
3155

3256
- name: Run tests
33-
# We only run tests in the smriti/test directory.
34-
# qmd/ tests are skipped here as they are part of the backbone submodule
35-
# and may have heavy dependencies (like local LLMs) that the runner lacks.
57+
# Full cross-platform test matrix for merge branches.
3658
run: bun test test/
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Dev Draft Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
8+
jobs:
9+
draft-release:
10+
name: Create/Update Dev Draft Release
11+
if: >
12+
github.event.workflow_run.conclusion == 'success' &&
13+
github.event.workflow_run.event == 'push' &&
14+
github.event.workflow_run.head_branch == 'dev'
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- name: Checkout dev commit
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.workflow_run.head_sha }}
24+
fetch-depth: 0
25+
submodules: recursive
26+
27+
- name: Compute dev tag
28+
id: tag
29+
run: |
30+
BASE_VERSION=$(node -p "require('./package.json').version")
31+
DEV_SUFFIX="dev.${{ github.event.workflow_run.run_number }}"
32+
DEV_TAG="v${BASE_VERSION}-${DEV_SUFFIX}"
33+
echo "base_version=${BASE_VERSION}" >> "$GITHUB_OUTPUT"
34+
echo "dev_tag=${DEV_TAG}" >> "$GITHUB_OUTPUT"
35+
36+
- name: Remove previous dev draft releases
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
const releases = await github.paginate(github.rest.repos.listReleases, {
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
per_page: 100,
44+
});
45+
46+
for (const release of releases) {
47+
const isDevTag = /-dev\.\d+$/.test(release.tag_name || "");
48+
if (isDevTag && release.draft) {
49+
await github.rest.repos.deleteRelease({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
release_id: release.id,
53+
});
54+
}
55+
}
56+
57+
- name: Remove previous dev tags
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
run: |
61+
for tag in $(git tag --list 'v*-dev.*'); do
62+
git push origin ":refs/tags/${tag}" || true
63+
done
64+
65+
- name: Create dev draft prerelease
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
tag_name: ${{ steps.tag.outputs.dev_tag }}
69+
target_commitish: ${{ github.event.workflow_run.head_sha }}
70+
name: Dev Draft ${{ steps.tag.outputs.dev_tag }}
71+
generate_release_notes: true
72+
draft: true
73+
prerelease: true

0 commit comments

Comments
 (0)