Skip to content

Commit

Permalink
workflow debug
Browse files Browse the repository at this point in the history
  • Loading branch information
tom2drum committed Feb 1, 2024
1 parent 3b27922 commit 0bf14c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,25 @@ jobs:
pw_affected_tests:
name: Resolve affected Playwright tests
runs-on: ubuntu-latest
needs: [ code_quality, envs_validation ]
# needs: [ code_quality, envs_validation ]
if: github.event_name == 'pull_request'
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.11.0
cache: 'yarn'

- name: Install dependencies and run script
run: cd ./deploy/tools/affected-tests && yarn --frozen-lockfile && node ./index.js
- name: Install dependencies and
run: cd ./deploy/tools/affected-tests && yarn --frozen-lockfile

- name: Run script
run: node ./deploy/tools/affected-tests/index.js

- name: Upload result file
uses: actions/upload-artifact@v4
Expand All @@ -145,7 +148,7 @@ jobs:

pw_tests:
name: 'Playwright tests / Project: ${{ matrix.project }}'
needs: [ code_quality, envs_validation, pw_affected_tests ]
needs: [ pw_affected_tests ]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.41.1-focal
Expand Down
9 changes: 6 additions & 3 deletions deploy/tools/affected-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ function getFileDeps(filename) {
}

async function getChangedFiles() {
const files = execSync(`git diff --name-only main...$(git symbolic-ref --short HEAD)`)
// eslint-disable-next-line max-len
const command = `git diff --name-only origin/${ process.env.GITHUB_BASE_REF || 'main' } origin/${ process.env.GITHUB_HEAD_REF || '$(git branch --show-current)' } -- ${ rootDir }`;
console.log('Executing command: ', command);
const files = execSync(command)
.toString()
.trim()
.split('\n')
Expand All @@ -41,6 +44,7 @@ async function run() {
fs.unlink(targetFile, () => {});

const changedFiles = await getChangedFiles();
console.log('ChangedFiles: ', changedFiles);

if (!changedFiles.length) {
console.log('No changed files found. Exiting...');
Expand All @@ -67,8 +71,7 @@ async function run() {
const end = Date.now();
console.log('Total time: ', ((end - start) / 1_000).toLocaleString());

console.log('ChangedFiles: ', changedFiles);
console.log('Test to run: ', testFileNamesToRun);
console.log('Tests to run: ', testFileNamesToRun);
console.log('Non existent deps: ', NON_EXISTENT_DEPS);

fs.writeFileSync(targetFile, testFileNamesToRun.join('\n'));
Expand Down

0 comments on commit 0bf14c0

Please sign in to comment.