From eeafe39b0a40156662ef48ea438c7411c74ec829 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Tue, 12 Dec 2023 13:08:26 -0800 Subject: [PATCH] GitHub workflow to ensure tests are up to date (#1505) Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1505 This will ensure that all tests are not modified by hand and that gentest was run if needed (i.e. someone edited those files and forgot to update the tests). Not sure if this works right now, need to export to github and see what happens :) Reviewed By: NickGerleman Differential Revision: D52002920 fbshipit-source-id: 24167da1bd10a18ea66239b337fcb32ac309e424 --- .github/workflows/validate-tests.yml | 33 ++++++++++++++++++++++++++++ gentest/gentest-driver.ts | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/validate-tests.yml diff --git a/.github/workflows/validate-tests.yml b/.github/workflows/validate-tests.yml new file mode 100644 index 0000000000..16b4be49a7 --- /dev/null +++ b/.github/workflows/validate-tests.yml @@ -0,0 +1,33 @@ +name: Validate Tests + +on: + pull_request: + push: + branches: + - main + - 'release-*' + workflow_dispatch: + +jobs: + validate: + name: Validate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup JS + uses: ./.github/actions/setup-js + + - name: yarn gentest-validate + run: yarn gentest-validate + + - name: yarn gentest + run: yarn gentest -h + + - name: Check for modified tests + run: | + if [[ -n $(git status -s) ]]; then + git status -s + echo "yarn gentest modified these tests. Please run yarn gentest to resolve." + exit 1 + fi diff --git a/gentest/gentest-driver.ts b/gentest/gentest-driver.ts index 6c62de6e7f..0ff8bd1602 100644 --- a/gentest/gentest-driver.ts +++ b/gentest/gentest-driver.ts @@ -31,6 +31,7 @@ function addSignatureToSourceCode(sourceCode: string): string { const argv = minimist(process.argv.slice(2)); const specificFixture = argv.f || argv.fixture; const suspend = argv.s || argv.suspend; +const headless = argv.h || argv.headless; const gentestDir = dirname(fileURLToPath(import.meta.url)); const yogaDir = dirname(gentestDir); @@ -54,6 +55,7 @@ options.addArguments( '--window-position=0,0', '--hide-scrollbars', ); +headless && options.addArguments('--headless'); options.setLoggingPrefs({ browser: 'ALL', performance: 'ALL',