Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #341 from github/rneatherway/gate-integration-testing
Gate execution of expensive tests on JS being up to date
Robin Neatherway authored and GitHub committed Dec 16, 2020

Unverified

No user is associated with the committer email.
2 parents cbd120e + cea5932 commit 9f7bdec
Showing 4 changed files with 81 additions and 38 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/integration-testing.yml
@@ -6,7 +6,27 @@ on:
pull_request:

jobs:
# This job and check-node-modules below dupliacte checks from `pr-checks.yml`.
# We run them here as well to gate the more expensive checks which wouldn't
# even be executing the correct code if these fail.
check-js:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Check generated JavaScript
run: .github/workflows/script/check-js.sh

check-node-modules:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Check node modules up to date
run: .github/workflows/script/check-node-modules.sh

multi-language-repo_test-autodetect-languages:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
@@ -40,6 +60,7 @@ jobs:
fi
multi-language-repo_test-custom-queries-and-remote-config:
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
@@ -69,6 +90,7 @@ jobs:

# Currently is not possible to analyze Go in conjunction with other languages in macos
multi-language-repo_test-go-custom-queries:
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
@@ -99,6 +121,7 @@ jobs:
TEST_MODE: true

go-custom-tracing:
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
@@ -130,6 +153,7 @@ jobs:
TEST_MODE: true

go-custom-tracing-autobuild:
needs: [check-js, check-node-modules]
# No need to test Go autobuild on multiple OSes since
# we're testing Go custom tracing with a manual build on all OSes.
runs-on: ubuntu-latest
@@ -153,6 +177,7 @@ jobs:
TEST_MODE: true

multi-language-repo_rubocop:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
@@ -184,6 +209,7 @@ jobs:
TEST_MODE: true

test-proxy:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
@@ -211,6 +237,7 @@ jobs:
TEST_MODE: true

runner-analyze-javascript-ubuntu:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
@@ -237,6 +264,7 @@ jobs:
TEST_MODE: true

runner-analyze-javascript-windows:
needs: [check-js, check-node-modules]
runs-on: windows-latest

steps:
@@ -259,6 +287,7 @@ jobs:
TEST_MODE: true

runner-analyze-javascript-macos:
needs: [check-js, check-node-modules]
runs-on: macos-latest

steps:
@@ -281,6 +310,7 @@ jobs:
TEST_MODE: true

runner-analyze-csharp-ubuntu:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
@@ -315,6 +345,7 @@ jobs:
TEST_MODE: true

runner-analyze-csharp-windows:
needs: [check-js, check-node-modules]
runs-on: windows-latest

steps:
@@ -350,6 +381,7 @@ jobs:
TEST_MODE: true

runner-analyze-csharp-macos:
needs: [check-js, check-node-modules]
runs-on: macos-latest

steps:
@@ -386,6 +418,7 @@ jobs:


runner-analyze-csharp-autobuild-ubuntu:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
@@ -419,6 +452,7 @@ jobs:
TEST_MODE: true

runner-analyze-csharp-autobuild-windows:
needs: [check-js, check-node-modules]
runs-on: windows-latest

steps:
@@ -453,6 +487,7 @@ jobs:
TEST_MODE: true

runner-analyze-csharp-autobuild-macos:
needs: [check-js, check-node-modules]
runs-on: macos-latest

steps:
@@ -487,6 +522,7 @@ jobs:
TEST_MODE: true

runner-upload-sarif:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

if: ${{ github.event_name != 'pull_request' || github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }}
41 changes: 3 additions & 38 deletions .github/workflows/pr-checks.yml
@@ -20,53 +20,18 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Check generated JavaScript
run: |
# Sanity check that repo is clean to start with
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then this workflow needs attention...
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
# Wipe the lib directory incase there are extra unnecessary files in there
rm -rf lib
# Generate the JavaScript files
npm run-script build
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: JavaScript files are not up to date. Run 'npm run-script build' to update"
git status
exit 1
fi
echo "Success: JavaScript files are up to date"
run: .github/workflows/script/check-js.sh

check-node-modules:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Check node modules up to date
run: |
# Sanity check that repo is clean to start with
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then this workflow needs attention...
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
# Reinstall modules and then clean to remove absolute paths
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
npm ci
npm run removeNPMAbsolutePaths
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci' and 'npm run removeNPMAbsolutePaths' to update"
git status
exit 1
fi
echo "Success: node_modules are up to date"
run: .github/workflows/script/check-node-modules.sh

npm-test:
needs: [check-js, check-node-modules]
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
21 changes: 21 additions & 0 deletions .github/workflows/script/check-js.sh
@@ -0,0 +1,21 @@
#!/bin/bash
set -eu

# Sanity check that repo is clean to start with
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then this workflow needs attention...
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
# Wipe the lib directory incase there are extra unnecessary files in there
rm -rf lib
# Generate the JavaScript files
npm run-script build
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: JavaScript files are not up to date. Run 'npm run-script build' to update"
git status
exit 1
fi
echo "Success: JavaScript files are up to date"
21 changes: 21 additions & 0 deletions .github/workflows/script/check-node-modules.sh
@@ -0,0 +1,21 @@
#!/bin/bash
set -eu

# Sanity check that repo is clean to start with
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then this workflow needs attention...
>&2 echo "Failed: Repo should be clean before testing!"
exit 1
fi
# Reinstall modules and then clean to remove absolute paths
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
npm ci
npm run removeNPMAbsolutePaths
# Check that repo is still clean
if [ ! -z "$(git status --porcelain)" ]; then
# If we get a fail here then the PR needs attention
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci' and 'npm run removeNPMAbsolutePaths' to update"
git status
exit 1
fi
echo "Success: node_modules are up to date"

0 comments on commit 9f7bdec

Please sign in to comment.