Skip to content

Commit

Permalink
follow proxy settings (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsciple authored Jan 27, 2020
1 parent 9a99bb3 commit d123f10
Show file tree
Hide file tree
Showing 568 changed files with 15,974 additions and 93,742 deletions.
86 changes: 71 additions & 15 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,81 @@
name: Main workflow
on: [push]

on:
pull_request:
push:
branches:
- master
- releases/*

jobs:
run:
name: Run
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@master

- name: Set Node.js 10.x
uses: actions/setup-node@master
with:
version: 10.x
- uses: actions/checkout@v2
- name: Setup node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run pack
- run: npm test
- name: Verify no unstaged changes
if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh

- name: npm install
run: npm install
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10

- name: Lint
run: npm run format-check
test-proxy:
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 node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10

- name: npm test
run: npm test
test-bypass-proxy:
runs-on: ubuntu-latest
env:
https_proxy: http://no-such-proxy:3128
no_proxy: github.com,nodejs.org,registry.npmjs.org
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
!node_modules/
node_modules/
lib/
__tests__/runner/*

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
Expand Down
17 changes: 17 additions & 0 deletions __tests__/verify-no-unstaged-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [[ "$(git status --porcelain)" != "" ]]; then
echo ----------------------------------------
echo git status
echo ----------------------------------------
git status
echo ----------------------------------------
echo git diff
echo ----------------------------------------
git diff
echo ----------------------------------------
echo Troubleshooting
echo ----------------------------------------
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run all"
exit 1
fi
19 changes: 19 additions & 0 deletions __tests__/verify-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -z "$1" ]; then
echo "Must supply node version argument"
exit 1
fi

node_version="$(node --version)"
echo "Found node version '$node_version'"
if [ -z "$(echo $node_version | grep v$1)" ]; then
echo "Unexpected version"
exit 1
fi

echo "Testing npm install"
mkdir -p test-npm-install
cd test-npm-install
npm init -y || exit 1
npm install @actions/core || exit 1
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ inputs:
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead'
runs:
using: 'node12'
main: 'lib/setup-node.js'
main: 'dist/index.js'
Loading

0 comments on commit d123f10

Please sign in to comment.