-
Notifications
You must be signed in to change notification settings - Fork 821
standardize workflow test pattern #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,85 @@ | ||
| name: Main workflow | ||
| on: [push, pull_request] | ||
| jobs: | ||
| run: | ||
| name: Run | ||
| build: | ||
| runs-on: ${{ matrix.operating-system }} | ||
| strategy: | ||
| matrix: | ||
| operating-system: [ubuntu-latest, windows-latest] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Node.js 12.x | ||
| - name: Setup Node.js 12 | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 12.x | ||
|
|
||
| - name: npm install | ||
| run: npm install | ||
|
|
||
| - name: Lint | ||
| run: npm run format-check | ||
|
|
||
| - name: npm test | ||
| run: npm test | ||
| run-with-proxy: | ||
| name: Run with proxy | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| squid: | ||
| image: dakale/squid | ||
| ports: ['3128:3128'] | ||
| options: '--health-cmd "exit 0" --health-interval 3s' | ||
| env: | ||
| http_proxy: http://localhost:3128 | ||
| https_proxy: http://localhost:3128 | ||
|
|
||
| test: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added E2E test job that leverages |
||
| runs-on: ${{ matrix.operating-system }} | ||
| strategy: | ||
| matrix: | ||
| operating-system: [ubuntu-latest, windows-latest] | ||
| steps: | ||
| - name: Block non proxied traffic | ||
| run: | | ||
| echo "127.0.0.0 registry.npm.js nodejs.org github.com api.github.com download.java.net static.azul.com" | sudo tee -a /etc/hosts | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Node.js 12.x | ||
| uses: actions/setup-node@v1 | ||
| - name: Clear tool cache | ||
| if: runner.os != 'windows' | ||
| run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old" | ||
| - name: Clear tool cache (Windows) | ||
| if: runner.os == 'windows' | ||
| run: move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old" | ||
| - name: Setup Java 13 | ||
| uses: ./ | ||
| with: | ||
| node-version: 12.x | ||
| java-version: 13.0.2 | ||
| - name: Verify Java 13 | ||
| if: runner.os != 'windows' | ||
| run: __tests__/verify-java.sh 13.0.2 | ||
| - name: Verify Java 13 (Windows) | ||
| if: runner.os == 'windows' | ||
| run: __tests__/verify-java.ps1 13.0.2 | ||
|
|
||
| - name: npm install | ||
| run: npm install | ||
|
|
||
| - name: Lint | ||
| run: npm run format-check | ||
| test-proxy: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched the proxy test to:
|
||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:latest | ||
| options: --dns 127.0.0.1 | ||
| services: | ||
| squid-proxy: | ||
| image: datadog/squid:latest | ||
| ports: | ||
| - 3128:3128 | ||
| env: | ||
| https_proxy: http://squid-proxy:3128 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Clear tool cache | ||
| run: rm -rf $RUNNER_TOOL_CACHE/* | ||
| - name: Setup Java 13 | ||
| uses: ./ | ||
| with: | ||
| java-version: 13.0.2 | ||
| - name: Verify Java 13 | ||
| run: __tests__/verify-java.sh 13.0.2 | ||
|
|
||
| - name: npm test | ||
| run: npm test | ||
| test-bypass-proxy: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an E2E proxy bypass test also |
||
| runs-on: ubuntu-latest | ||
| env: | ||
| https_proxy: http://no-such-proxy:3128 | ||
| no_proxy: github.com,static.azul.com | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Clear tool cache | ||
| run: rm -rf $RUNNER_TOOL_CACHE/* | ||
| - name: Setup Java 13 | ||
| uses: ./ | ||
| with: | ||
| java-version: 13.0.2 | ||
| - name: Verify Java 13 | ||
| run: __tests__/verify-java.sh 13.0.2 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| if (!$args.Count -or !$args[0]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. helper script to validate a specific version of java is in the PATH |
||
| { | ||
| throw "Must supply java version argument" | ||
| } | ||
|
|
||
| $java_version = & cmd.exe /c "java -version 2>&1" | Out-String | ||
| Write-Host "Found java version: $java_version" | ||
| if (!$java_version.Contains($args[0])) | ||
| { | ||
| throw "Unexpected version" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
|
|
||
| if [ -z "$1" ]; then | ||
| echo "Must supply java version argument" | ||
| exit 1 | ||
| fi | ||
|
|
||
| java_version="$(java -version 2>&1)" | ||
| echo "Found java version: $java_version" | ||
| if [ -z "$(echo $java_version | grep --fixed-strings $1)" ]; then | ||
| echo "Unexpected version" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i removed the empty lines between steps since the file is much larger now (tighten up individual jobs, to make file more skimmable)