Skip to content

Commit cf5f899

Browse files
committed
follow proxy settings
1 parent b782114 commit cf5f899

File tree

627 files changed

+22615
-104481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

627 files changed

+22615
-104481
lines changed

.github/workflows/workflow.yml

Lines changed: 79 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,91 @@
11
name: Main workflow
2-
on: [push, pull_request]
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- releases/*
9+
310
jobs:
4-
run:
5-
name: Run
11+
build:
612
runs-on: ${{ matrix.operating-system }}
713
strategy:
814
matrix:
915
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
1016
steps:
1117
- name: Checkout
12-
uses: actions/checkout@master
13-
14-
- name: Set Node.js 10.x
15-
uses: actions/setup-node@master
18+
uses: actions/checkout@v2
19+
- name: Set Node.js 12
20+
uses: actions/setup-node@v1
1621
with:
17-
version: 10.x
22+
version: 12.x
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm run format-check
26+
- run: npm test
27+
- name: Verify no unstaged changes
28+
if: runner.os != 'windows'
29+
run: __tests__/verify-no-unstaged-changes.sh
1830

19-
- name: npm install
20-
run: npm install
31+
test:
32+
runs-on: ${{ matrix.operating-system }}
33+
strategy:
34+
matrix:
35+
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
- name: Clear tool cache
40+
run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
41+
- name: Setup dotnet 3.0.100
42+
uses: ./
43+
with:
44+
dotnet-version: 3.0.100
45+
- name: Verify dotnet
46+
if: runner.os != 'windows'
47+
run: __tests__/verify-dotnet.sh 3.0.100
48+
- name: Verify dotnet (Windows)
49+
if: runner.os == 'windows'
50+
run: __tests__/verify-dotnet.ps1 3.0.100
2151

22-
- name: Lint
23-
run: npm run format-check
52+
test-proxy:
53+
runs-on: ubuntu-latest
54+
container:
55+
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
56+
options: --dns 127.0.0.1
57+
services:
58+
squid-proxy:
59+
image: datadog/squid:latest
60+
ports:
61+
- 3128:3128
62+
env:
63+
https_proxy: http://squid-proxy:3128
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
- name: Clear tool cache
68+
run: rm -rf $RUNNER_TOOL_CACHE/*
69+
- name: Setup dotnet 3.0.100
70+
uses: ./
71+
with:
72+
dotnet-version: 3.0.100
73+
- name: Verify dotnet
74+
run: __tests__/verify-dotnet.sh 3.0.100
2475

25-
- name: npm test
26-
run: npm test
76+
test-bypass-proxy:
77+
runs-on: ubuntu-latest
78+
env:
79+
https_proxy: http://no-such-proxy:3128
80+
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v2
84+
- name: Clear tool cache
85+
run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
86+
- name: Setup dotnet 3.0.100
87+
uses: ./
88+
with:
89+
dotnet-version: 3.0.100
90+
- name: Verify dotnet
91+
run: __tests__/verify-dotnet.sh 3.0.100

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
2-
!node_modules/
1+
lib/
2+
node_modules/
33
__tests__/runner/*
4+
__tests__/sample-csproj/bin/
5+
__tests__/sample-csproj/obj/
46

57
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
68
# Logs

__tests__/installer.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import io = require('@actions/io');
22
import fs = require('fs');
33
import os = require('os');
44
import path = require('path');
5-
import httpClient = require('typed-rest-client/HttpClient');
5+
import hc = require('@actions/http-client');
66

77
const toolDir = path.join(__dirname, 'runner', 'tools');
88
const tempDir = path.join(__dirname, 'runner', 'temp');
@@ -74,14 +74,14 @@ describe('installer tests', () => {
7474
});
7575

7676
it('Uses an up to date bash download script', async () => {
77-
var httpCallbackClient = new httpClient.HttpClient(
78-
'setup-dotnet-test',
79-
[],
80-
{}
81-
);
82-
const response: httpClient.HttpClientResponse = await httpCallbackClient.get(
77+
const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], {
78+
allowRetries: true,
79+
maxRetries: 3
80+
});
81+
const response: hc.HttpClientResponse = await httpCallbackClient.get(
8382
'https://dot.net/v1/dotnet-install.sh'
8483
);
84+
expect(response.message.statusCode).toBe(200);
8585
const upToDateContents: string = await response.readBody();
8686
const currentContents: string = fs
8787
.readFileSync(
@@ -94,14 +94,14 @@ describe('installer tests', () => {
9494
}, 100000);
9595

9696
it('Uses an up to date powershell download script', async () => {
97-
var httpCallbackClient = new httpClient.HttpClient(
98-
'setup-dotnet-test',
99-
[],
100-
{}
101-
);
102-
const response: httpClient.HttpClientResponse = await httpCallbackClient.get(
97+
var httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], {
98+
allowRetries: true,
99+
maxRetries: 3
100+
});
101+
const response: hc.HttpClientResponse = await httpCallbackClient.get(
103102
'https://dot.net/v1/dotnet-install.ps1'
104103
);
104+
expect(response.message.statusCode).toBe(200);
105105
const upToDateContents: string = await response.readBody();
106106
const currentContents: string = fs
107107
.readFileSync(

__tests__/sample-csproj/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace sample_csproj
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
var json = JsonConvert.SerializeObject(new[] {"Hello", "World!" });
11+
Console.WriteLine(json);
12+
}
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"runtimeOptions": {
3+
"configProperties": {
4+
"System.Globalization.Invariant": true
5+
}
6+
}
7+
}

__tests__/sample-csproj/sample.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
<RootNamespace>sample_csproj</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
11+
</ItemGroup>
12+
13+
</Project>

__tests__/verify-dotnet.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
if (!$args[0])
2+
{
3+
throw "Must supply dotnet version argument"
4+
}
5+
6+
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
7+
Write-Host "Found '$dotnet'"
8+
9+
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
10+
Write-Host "Version $version"
11+
# if ($version -ne $args[0])
12+
# {
13+
# Write-Host "PATH='$env:path'"
14+
# Write-Host "gcm dotnet:"
15+
# gcm dotnet | fl
16+
# throw "Unexpected version"
17+
# }
18+
19+
Write-Host "Building sample csproj"
20+
& $dotnet build __tests__/sample-csproj/ --no-cache
21+
if ($LASTEXITCODE -ne 0)
22+
{
23+
throw "Unexpected exit code $LASTEXITCODE"
24+
}
25+
26+
Write-Host "Testing compiled app"
27+
$sample_output = "$(__tests__/sample-csproj/bin/Debug/netcoreapp3.0/sample.exe)".Trim()
28+
Write-Host "Sample output: $sample_output"
29+
if ($sample_output -notlike "*Hello*World*")
30+
{
31+
throw "Unexpected output"
32+
}

__tests__/verify-dotnet.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
if [ -z "$1" ]; then
2+
echo "Must supply dotnet version argument"
3+
exit 1
4+
fi
5+
6+
dotnet_version="$(dotnet --version)"
7+
echo "Found dotnet version '$dotnet_version'"
8+
if [ -z "$(echo $dotnet_version | grep $1)" ]; then
9+
echo "Unexpected version"
10+
exit 1
11+
fi
12+
13+
echo "Building sample csproj"
14+
dotnet build __tests__/sample-csproj/ --no-cache || exit 1
15+
16+
echo "Testing compiled app"
17+
sample_output="$(__tests__/sample-csproj/bin/Debug/netcoreapp3.0/sample)"
18+
echo "Sample output: $sample_output"
19+
if [ -z "$(echo $sample_output | grep Hello)" ]; then
20+
echo "Unexpected output"
21+
exit 1
22+
fi
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [[ "$(git status --porcelain)" != "" ]]; then
4+
echo ----------------------------------------
5+
echo git status
6+
echo ----------------------------------------
7+
git status
8+
echo ----------------------------------------
9+
echo git diff
10+
echo ----------------------------------------
11+
git diff
12+
echo ----------------------------------------
13+
echo Troubleshooting
14+
echo ----------------------------------------
15+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run pre-checkin"
16+
exit 1
17+
fi

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ inputs:
1919
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use dotnet-version instead'
2020
runs:
2121
using: 'node12'
22-
main: 'lib/setup-dotnet.js'
22+
main: 'dist/index.js'

0 commit comments

Comments
 (0)