Skip to content
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

Fix Mocks for Windows #877

Merged
merged 23 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 89 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
- name: Build
run: echo "Building on ${{ matrix.os }}"

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

osterman marked this conversation as resolved.
Show resolved Hide resolved
- name: Check out code into the Go module directory
uses: actions/checkout@v4

Expand Down Expand Up @@ -75,19 +79,57 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
- os: macos-latest
target: macos
flavor:
- { os: ubuntu-latest, target: linux }
- { os: windows-latest, target: windows }
- { os: macos-latest, target: macos }
timeout-minutes: 15
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.flavor.os }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ matrix.flavor.target }}
path: ${{ github.workspace }}

- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"

- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
$atmosPath = Join-Path ${{ github.workspace }} "atmos.exe"
if (-not (Test-Path $atmosPath)) {
throw "atmos.exe not found at: $atmosPath"
}
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down Expand Up @@ -279,26 +321,56 @@ jobs:

timeout-minutes: 20
steps:
- name: Download build artifacts
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ matrix.flavor.target }}
path: /usr/local/bin
path: ${{ github.workspace }}

- name: Set execute permissions on atmos
run: chmod +x /usr/local/bin/atmos
- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"

- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
run: |
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Run tests for ${{ matrix.demo-folder }}
- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
atmos test

- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version

- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
cd examples/${{ matrix.demo-folder }}
atmos test

# run other demo tests
Expand Down Expand Up @@ -352,7 +424,7 @@ jobs:
--minimum-failure-severity=warning
--recursive
--config=${{ github.workspace }}/examples/.tflint.hcl
fail_on_error: true
fail_level: error
osterman marked this conversation as resolved.
Show resolved Hide resolved

# run other demo tests
validate:
Expand Down
Loading
Loading