Merge pull request #2821 from PelicanPlatform/fix-issue-2820 #1482
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: Run Tests (macOS, Windows) | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| # Run only on release tags for v7.0.0 and up. | |
| - v[7-9]\.[0-9]+\.[0-9]+ | |
| - v[7-9]\.[0-9]+\.[0-9]+-rc\.[0-9]+ | |
| - v[1-9][0-9]+\.[0-9]+\.[0-9]+ | |
| - v[1-9][0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ | |
| repository_dispatch: | |
| types: | |
| - dispatch-build | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go-version: [1.24.x] | |
| os: [macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # Do fetch depth 0 here because otherwise GoReleaser might not work properly: | |
| # https://goreleaser.com/ci/actions/?h=tag#workflow | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Cache Next.js | |
| uses: actions/cache@v4 | |
| with: | |
| # Reference: https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions | |
| path: | | |
| ~/.npm | |
| web_ui/frontend/.next/cache | |
| # Generate a new cache whenever packages or source files change. | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '!**/node_modules/**') }} | |
| # If source files changed but packages didn't, rebuild from a prior cache. | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
| - name: Install Go | |
| if: runner.os != 'Windows' | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Create Go temporary directories (Windows workaround) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: mkdir D:\gotmp; mkdir D:\gomodcache; mkdir D:\gocache | |
| - name: Install Go (Windows workaround) | |
| if: runner.os == 'Windows' | |
| env: | |
| # Fix slow Go compile and cache restore: https://github.com/actions/setup-go/pull/515 | |
| GOCACHE: D:\gocache | |
| GOMODCACHE: D:\gomodcache | |
| GOTMPDIR: D:\gotmp | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Install macOS Dependencies | |
| run: ./github_scripts/osx_install.sh | |
| if: runner.os == 'macOS' | |
| - name: Test macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| make web-build | |
| #go test -timeout 15m -coverpkg=./director -covermode=count -coverprofile=coverage.out ./director -run TestStatMemory | |
| go test -p=4 -timeout 15m -coverpkg=./... -covermode=count -coverprofile=coverage.out ./... -skip TestStatMemory | |
| - name: Test Windows | |
| if: runner.os == 'Windows' | |
| env: | |
| # Fix slow Go compile and cache restore: https://github.com/actions/setup-go/pull/515 | |
| GOCACHE: D:\gocache | |
| GOMODCACHE: D:\gomodcache | |
| GOTMPDIR: D:\gotmp | |
| run: | | |
| make web-build | |
| go test -p=4 -timeout 15m -coverpkg=./... -covermode=count -coverprofile=coverage.out ./... | |
| - name: Run GoReleaser for macOS | |
| uses: goreleaser/goreleaser-action@v6 | |
| if: runner.os == 'macOS' | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: build --single-target --clean --snapshot | |
| - name: Run GoReleaser for Windows | |
| uses: goreleaser/goreleaser-action@v6 | |
| if: runner.os == 'Windows' | |
| env: | |
| # Fix slow Go compile and cache restore: https://github.com/actions/setup-go/pull/515 | |
| GOCACHE: D:\gocache | |
| GOMODCACHE: D:\gomodcache | |
| GOTMPDIR: D:\gotmp | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: build --single-target --clean --snapshot |