Debugging failing test #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
config: [windows-lcow] | |
include: | |
- config: windows-lcow | |
os: windows | |
runner: windows-latest | |
no_docker: "false" | |
pack_bin: pack.exe | |
runs-on: ${{ matrix.runner }} | |
env: | |
PACK_BIN: ${{ matrix.pack_bin }} | |
NO_DOCKER: ${{ matrix.no_docker }} | |
steps: | |
- name: Set git to use LF and symlinks | |
if: matrix.os == 'windows' | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
git config --global core.symlinks true | |
- uses: actions/checkout@v3 | |
- name: Derive pack version from branch name Unix | |
if: runner.os != 'Windows' | |
run: | | |
[[ $GITHUB_REF =~ ^refs\/heads\/release/(.*)$ ]] && version=${BASH_REMATCH[1]} || version=0.0.0 | |
echo "PACK_VERSION=${version}" >> $GITHUB_ENV | |
shell: bash | |
- name: Derive pack version from branch name Windows | |
if: runner.os == 'Windows' | |
run: | | |
if ($Env:GITHUB_REF -match '^refs\/heads\/release/(.*)$') { | |
$refmatch=$Matches[1] | |
echo "PACK_VERSION=${refmatch}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
else { | |
echo "PACK_VERSION=0.0.0" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
shell: powershell | |
- name: Set up go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
check-latest: true | |
- name: Set up go env for Unix | |
if: runner.os != 'Windows' | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Set up go env for Windows | |
if: runner.os == 'Windows' | |
run: | | |
echo "GOPATH=$(go env GOPATH)"| Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "$(go env GOPATH)\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append | |
shell: powershell | |
- name: Verify | |
run: make verify | |
- name: Register runner IP | |
if: matrix.config == 'windows-wcow' | |
shell: powershell | |
run: | | |
# Get IP from default gateway interface | |
$IPAddress=(Get-NetIPAddress -InterfaceAlias ((Get-NetRoute "0.0.0.0/0").InterfaceAlias) -AddressFamily IPv4)[0].IPAddress | |
# Allow container-to-host registry traffic (from public interface, to the same interface) | |
New-NetfirewallRule -DisplayName test-registry -LocalAddress $IPAddress -RemoteAddress $IPAddress | |
# create or update daemon config to allow host as insecure-registry | |
$config=@{} | |
if (Test-Path C:\ProgramData\docker\config\daemon.json) { | |
$config=(Get-Content C:\ProgramData\docker\config\daemon.json | ConvertFrom-json) | |
} | |
$config | Add-Member -Force -Name "insecure-registries" -value @("$IPAddress/32") -MemberType NoteProperty | |
ConvertTo-json $config | Out-File -Encoding ASCII C:\ProgramData\docker\config\daemon.json | |
Restart-Service docker | |
# dump docker info for auditing | |
docker version | |
docker info | |
# Modify etc\hosts to include runner IP | |
$IPAddress=(Get-NetIPAddress -InterfaceAlias ((Get-NetRoute "0.0.0.0/0").InterfaceAlias) -AddressFamily IPv4)[0].IPAddress | |
"# Modified by CNB: https://github.com/buildpacks/ci/tree/main/gh-runners/windows | |
${IPAddress} host.docker.internal | |
${IPAddress} gateway.docker.internal | |
" | Out-File -Filepath C:\Windows\System32\drivers\etc\hosts -Encoding utf8 | |
- name: Test | |
env: | |
TEST_COVERAGE: 1 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: make unit | |
- name: Upload Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./out/tests/coverage-unit.txt | |
flags: unit,os_${{ matrix.os }} | |
fail_ci_if_error: false | |
verbose: true | |
- name: Prepare Codecov | |
if: matrix.os == 'windows' | |
uses: crazy-max/ghaction-chocolatey@v2 | |
with: | |
args: install codecov -y | |
- name: run Codecov | |
if: matrix.os == 'windows' | |
run: | | |
codecov.exe -f ./out/tests/coverage-unit.txt -v --flag os_windows | |
- name: Build Unix | |
if: runner.os != 'Windows' | |
run: | | |
make build | |
env: | |
PACK_BUILD: ${{ github.run_number }} | |
shell: bash | |
- name: Build Windows | |
if: runner.os == 'Windows' | |
run: | | |
make build | |
env: | |
PACK_BUILD: ${{ github.run_number }} | |
shell: powershell | |
- uses: actions/upload-artifact@v3 | |
if: matrix.config != 'windows-lcow' | |
with: | |
name: pack-${{ matrix.os }} | |
path: out/${{ env.PACK_BIN }} |