Skip to content

Commit 1c8178f

Browse files
Upgrade to Allure v3 (#1603)
* Start of Allure v3 * CI setup for new Allure v3 * correct actions * lint * fix test naming * Update test snapshots * Update knip config, and remove legacy allure command line * lint again * remove now unused action * fix annoying spacing * cleanup testing definitions to ignore packages without tests
1 parent c5070e8 commit 1c8178f

42 files changed

Lines changed: 2109 additions & 137 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ component_management:
164164
name: "@withstudiocms/kysely"
165165
paths:
166166
- packages/@withstudiocms/kysely/**
167-
- component_id: withstudiocms_sdk
168-
name: "@withstudiocms/sdk"
169-
paths:
170-
- packages/@withstudiocms/sdk/**
171167
- component_id: withstudiocms_cli_kit
172168
name: "@withstudiocms/cli-kit"
173169
paths:

.devcontainer/devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
},
1818
"vscode": {
1919
"settings": {
20-
"js/ts.tsdk.path": "node_modules/typescript/lib",
2120
"editor.codeActionsOnSave": {
2221
"source.fixAll.biome": "explicit"
2322
},

.github/actions/allure-report/action.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/ci-testing.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ jobs:
7171
with:
7272
persist-credentials: true
7373

74+
- name: Checkout Allure Test history
75+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
76+
with:
77+
ref: allure/history
78+
path: test-history
79+
persist-credentials: false
80+
7481
- name: Install Tools & Dependencies
7582
uses: withstudiocms/automations/.github/actions/install@f32588d80ce35d57905264f7fa473b0f6e297c0a # main
7683

@@ -80,17 +87,31 @@ jobs:
8087
- name: Run Tests & Code Coverage
8188
run: pnpm ci:test
8289

83-
# Allure Reports Require to be ran from within our repository only
84-
# So we check if the PR is from a fork or from the same repository
85-
- name: Generate Allure Report and Deploy
86-
if: always() && (github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main')
87-
uses: ./.github/actions/allure-report
90+
# Only run on PRs
91+
- name: Report Allure results
92+
if: github.event_name == 'pull_request'
93+
uses: allure-framework/allure-action@bd0373251ed3f1c5ac9aa44ac86ed40d839b3094 # v0.8.0
94+
with:
95+
report-directory: "./allure-report"
96+
github-token: ${{ secrets.GITHUB_TOKEN }}
97+
98+
# Only upload Allure report results to Github if we are a push to main
99+
- name: Upload Allure Report to Github Branch
100+
if: github.event_name == 'push'
101+
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
102+
with:
103+
github_token: ${{ secrets.GITHUB_TOKEN }}
104+
publish_branch: allure/report
105+
publish_dir: ./allure-report
106+
107+
# Only upload Allure report results to Github if we are a push to main
108+
- name: Upload Allure History to Github Branch
109+
if: github.event_name == 'push'
110+
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
88111
with:
89-
gh_pages_branch: testing/allure
90-
gh_page_history: testing/allure
91-
allure_report_id: studiocms-tests
92-
allure_report_dir: allure-results
93-
cname: tests.studiocms.dev
112+
github_token: ${{ secrets.GITHUB_TOKEN }}
113+
publish_branch: allure/history
114+
publish_dir: ./test-history
94115

95116
- name: Upload coverage report to Codecov
96117
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ junit-report.xml
1818
dist
1919

2020
# allure results
21-
allure-results/*
2221
allure-results
22+
allure-report
23+
history.jsonl
2324

24-
.env
25+
.env

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"js/ts.tsdk.path": "node_modules/typescript/lib",
32
"editor.fontFamily": "Fira Code Retina, Menlo, Monaco, 'Courier New', monospace",
43
"editor.fontLigatures": true,
54
"editor.fontSize": 14.2,

allurerc.mjs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { defineConfig } from 'allure';
2+
3+
const packagesWithTests = [
4+
'studiocms',
5+
'effectify',
6+
7+
'@studiocms/auth0',
8+
'@studiocms/discord',
9+
'@studiocms/github',
10+
'@studiocms/google',
11+
'@studiocms/devapps',
12+
'@studiocms/html',
13+
'@studiocms/cloudinary-image-service',
14+
'@studiocms/md',
15+
'@studiocms/mdx',
16+
'@studiocms/blog',
17+
'@studiocms/markdoc',
18+
'@studiocms/markdown-remark',
19+
'@studiocms/wysiwyg',
20+
21+
'@withstudiocms/auth-kit',
22+
'@withstudiocms/buildkit',
23+
'@withstudiocms/cli-kit',
24+
'@withstudiocms/component-registry',
25+
'@withstudiocms/config-utils',
26+
'@withstudiocms/effect',
27+
'@withstudiocms/internal_helpers',
28+
'@withstudiocms/template-lang',
29+
'@withstudiocms/kysely',
30+
];
31+
32+
// Create a plugins configuration object for each package with tests, using the @allurereport/plugin-awesome plugin. The report will be named `${pkg} Tests`, and will be published to the Allure server.
33+
const pluginsConfig = Object.fromEntries(
34+
packagesWithTests.map((pkg) => [
35+
pkg,
36+
{
37+
import: '@allurereport/plugin-awesome',
38+
options: {
39+
reportName: `${pkg} Tests`,
40+
singleFile: false,
41+
reportLanguage: 'en',
42+
open: false,
43+
publish: true,
44+
groupBy: ['parentSuite', 'suite', 'subSuite'],
45+
filter: ({ labels }) =>
46+
labels.find(({ name, value }) => name === 'parentSuite' && value === `${pkg} Tests`),
47+
},
48+
},
49+
])
50+
);
51+
52+
// Export the Allure configuration object, which includes the plugins configuration for each package with tests, as well as some general settings for the Allure report.
53+
export default defineConfig({
54+
name: 'Allure Report',
55+
output: './allure-report',
56+
historyPath: './test-history/history.jsonl',
57+
appendHistory: true,
58+
historyLimit: 20,
59+
qualityGate: {
60+
rules: [
61+
{
62+
maxFailures: 0,
63+
fastFail: true,
64+
},
65+
],
66+
},
67+
plugins: {
68+
...pluginsConfig,
69+
log: {
70+
options: {
71+
groupBy: 'none',
72+
},
73+
},
74+
},
75+
});

cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
"YYYYMMDDTHHMMSS",
258258
"zipx",
259259
"zizmor",
260-
"zizmorcore"
260+
"zizmorcore",
261+
"allurereport"
261262
]
262263
}

knip.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ const config: KnipConfig = {
181181
exclude: ['duplicates', 'optionalPeerDependencies'],
182182
workspaces: {
183183
'.': {
184-
ignoreDependencies: ['@changesets/config', 'studiocms', 'vite', 'allure-js-commons'],
184+
ignoreDependencies: [
185+
'@changesets/config',
186+
'studiocms',
187+
'vite',
188+
'allure-js-commons',
189+
'@allurereport/plugin-awesome',
190+
],
185191
ignoreBinaries: [/ci:.*$/, /bundle-test:.*$/, 'du'],
186192
entry: ['.github/workflows/*.yml', '.github/scripts/**/*.mjs', 'scripts/**/*.mjs'],
187193
project: ['.github/scripts/**/*.mjs', 'scripts/**/*.mjs'],

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@
6666
"ci:version": "pnpm changeset version && pnpm ci:update-templates && pnpm install --no-frozen-lockfile && pnpm run lint:fix",
6767
"ci:publish": "pnpm changeset publish",
6868
"ci:snapshot": "pnpx pkg-pr-new publish --pnpm './packages/*'",
69-
"ci:test": "vitest run --coverage",
69+
70+
"ci:vitest": "vitest run --coverage",
71+
"ci:test": "allure run -- pnpm ci:vitest",
7072
"ci:build": "pnpm build:packages",
7173

74+
"allure:view": "allure open allure-report",
75+
7276
"ci:typecheck:studiocms": "pnpm --filter studiocms typecheck",
7377
"ci:typecheck:studiocms-packages": "pnpm --filter @studiocms/* --filter create-studiocms typecheck",
7478
"ci:typecheck:withstudiocms": "pnpm --filter @withstudiocms/* --filter effectify typecheck",
@@ -83,6 +87,7 @@
8387
},
8488
"devDependencies": {
8589
"@actions/core": "^3.0.1",
90+
"@allurereport/plugin-awesome": "^3.14.2",
8691
"@biomejs/biome": "^2.5.3",
8792
"@changesets/changelog-github": "^0.7.0",
8893
"@changesets/cli": "^2.31.0",
@@ -95,9 +100,9 @@
95100
"@types/node": "catalog:",
96101
"@vitest/coverage-v8": "^3.2.4",
97102
"@withstudiocms/buildkit": "workspace:^",
103+
"allure": "^3.14.2",
98104
"allure-js-commons": "^3.10.2",
99105
"allure-vitest": "^3.10.2",
100-
"allure-commandline": "^2.43.0",
101106
"execa": "^9.6.1",
102107
"knip": "^6.26.0",
103108
"pkg-pr-new": "^0.0.75",

0 commit comments

Comments
 (0)