Skip to content

Commit

Permalink
ci: fix branch determination logic (#2568) (#2572)
Browse files Browse the repository at this point in the history
* ci: fix branch determination logic

* chore: fix eslint

* ci: fix label logic

* chore: revert logic that was working

* chore: nope - src  filtering clash

* chore: new changes

* ci: verify variables

* ci: fix

* ci: path variable

* ci: final change

(cherry picked from commit a1bb5e1)

Co-authored-by: Karl Cardenas <karl@spectrocloud.com>
  • Loading branch information
1 parent 37a2db2 commit 7f81e7e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/visual-comparison.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
pull_request:
types: [opened, reopened, synchronize, labeled]
branches-ignore: ["version-*", "release-*"]
paths:
- 'src/**'
- 'package.json'
- 'package-lock.json'


env:
Expand All @@ -18,8 +14,7 @@ env:
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
HTML_REPORT_URL_PATH: reports/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }}

HTML_REPORT_URL_PATH: reports/${{ github.head_ref }}/${{ github.run_id }}/${{ github.run_attempt }}


concurrency:
Expand All @@ -33,12 +28,18 @@ jobs:
defaults:
run:
shell: bash
if: ${{ !github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' || contains(github.event.pull_request.labels.*.name, 'visual-tests') }}
if: ${{ !github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && contains(github.event.pull_request.labels.*.name, 'visual-tests') }}
steps:
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped.
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed.
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI.
- run: exit 0
- run: |
echo "GITHUB_BASE_REF: ${{ github.base_ref }}"
echo "GITHUB_HEAD_REF: ${{ github.head_ref }}"
echo "GITHUB_REF_NAME: ${{ github.ref_name }}"
echo "HTML_REPORT_URL_PATH ${{ env.HTML_REPORT_URL_PATH }}"
exit 0
create-assets:
Expand Down Expand Up @@ -235,7 +236,7 @@ jobs:
uses: mshick/add-pr-comment@v2
with:
message: |
📋 Visual Report for PR ${{ github.ref_name }} with CI run ${{ github.run_id }} and attempt ${{ github.run_attempt }} is ready at
📋 Visual Report for branch ${{ github.head_ref }} with CI run ${{ github.run_id }} and attempt ${{ github.run_attempt }} is ready at
https://spectrocloud.github.io/librarium/${{env.HTML_REPORT_URL_PATH}}
💡 You may have to wait for DNS to resolve or the GitHub Pages job to complete. You can view the progress of the GitHub Pages job [here](https://github.com/spectrocloud/librarium/actions/workflows/pages/pages-build-deployment).
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"allowJs": true
},
"extends": "./tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "./.eslintrc.js", "*.d.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "./.eslintrc.js", "*.d.ts", "visuals/**/*.ts", "playwright.config.ts"],
"exclude": ["**/node_modules", "deprecated"]
}
4 changes: 2 additions & 2 deletions visuals/screenshot.api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as fs from "fs";
import { test, expect } from "@playwright/test";
import { extractSitemapPathnames, WaitForDocusaurusHydration } from "./utils";
import excludeList from "./exclude.json";

const siteUrl = "http://localhost:3000";
const sitemapPath = "build/sitemap.xml";
const stylesheetPath = "visuals/screenshot.css";
const stylesheet = fs.readFileSync(stylesheetPath).toString();
const excludeList = require("./exclude.json");

test.describe.configure({ mode: "parallel" });

Expand All @@ -21,7 +21,7 @@ function isApiDocsPathname(pathname: string, excludeList: string[]): boolean {
return false;
}

test.beforeAll(async () => {
test.beforeAll(() => {
console.log("Excluded pages: ", excludeList);
console.log("Total pages: ", extractSitemapPathnames(sitemapPath).length);
});
Expand Down
6 changes: 3 additions & 3 deletions visuals/screenshot.docs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as fs from "fs";
import { test, expect } from "@playwright/test";
import { extractSitemapPathnames, WaitForDocusaurusHydration } from "./utils";
// Constants:
import excludeList from "./exclude.json";

const siteUrl = "http://localhost:3000";
const sitemapPath = "build/sitemap.xml";
const stylesheetPath = "visuals/screenshot.css";
const stylesheet = fs.readFileSync(stylesheetPath).toString();
const excludeList = require("./exclude.json");

test.describe.configure({ mode: "parallel" });

Expand All @@ -23,7 +23,7 @@ function isVersionedDocsPathname(pathname: string, excludeList: string[]): boole
return true;
}

test.beforeAll(async () => {
test.beforeAll(() => {
console.log("Excluded pages: ", excludeList);
console.log("Total pages: ", extractSitemapPathnames(sitemapPath).length);
});
Expand Down

0 comments on commit 7f81e7e

Please sign in to comment.