Another try 3 #12
This file contains hidden or 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: Pre-Build Workflow | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| jobs: | |
| tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-22.04 | |
| - ubuntu-24.04 | |
| - windows-2019 | |
| - windows-2022 | |
| - windows-2025 | |
| - macos-13 | |
| - macos-14 | |
| - macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Directory Listing and Cleanup for Linux/Mac | |
| - name: Directory Listing and Cleanup (Linux/Mac) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ls -la ~/go/pkg/mod || echo "Directory does not exist" | |
| rm -rf ~/.cache/go-build ~/go/pkg/mod || true | |
| shell: bash | |
| # Directory Listing and Cleanup for Windows | |
| - name: Directory Listing and Cleanup (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| if (Test-Path -Path "$env:USERPROFILE\go\pkg\mod") { | |
| Get-ChildItem -Force -Recurse "$env:USERPROFILE\go\pkg\mod" | |
| } else { | |
| Write-Output "Directory does not exist" | |
| } | |
| if (Test-Path -Path "$env:USERPROFILE\.cache\go-build") { | |
| Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\go-build" | |
| } | |
| if (Test-Path -Path "$env:USERPROFILE\go\pkg\mod") { | |
| Remove-Item -Recurse -Force "$env:USERPROFILE\go\pkg\mod" | |
| } | |
| shell: pwsh | |
| # Cache Go modules to speed up builds | |
| - name: Cache Go Modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: go-mod-${{ matrix.os }}-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| go-mod-${{ matrix.os }}- | |
| go-mod- | |
| # Run tests | |
| - uses: ./.github/actions/test | |
| # Lint the code | |
| - uses: ./.github/actions/lint |