Skip to content

chore: run ci on windows #213

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

Merged
merged 6 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ runs:

- name: Clean Go module cache dir
shell: bash
if: runner.os == 'linux'
run: sudo rm -rf ~/go/pkg/mod/golang.org/toolchain*

- name: Go cache
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ env:
jobs:
test-go:
name: Test Go
runs-on: rspack-ubuntu-22.04-large
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [rspack-ubuntu-22.04-large, windows-latest]
go-version: ['1.24.1']
steps:
- name: Checkout code
Expand All @@ -39,23 +40,27 @@ jobs:
go-version: ${{ matrix.go-version }}
cache-name: test-go
- name: golangci-lint
if: runner.os == 'Linux'
uses: golangci/golangci-lint-action@v8
with:
version: v2.3.0
args: --timeout=5m ./cmd/... ./internal/...
- name: go vet
if: runner.os == 'Linux'
run: npm run lint:go
- name: go fmt
if: runner.os == 'Linux'
run: npm run format:go
- name: Unit Test
run: |
go test -parallel 4 ./internal/...
test-node:
name: Test npm packages
runs-on: rspack-ubuntu-22.04-large
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [rspack-ubuntu-22.04-large, windows-latest]
go-version: ['1.24.1']
steps:
- name: Checkout code
Expand All @@ -73,16 +78,18 @@ jobs:
uses: ./.github/actions/setup-node

- name: Format
if: runner.os == 'Linux'
run: pnpm format:check

- name: Build
run: pnpm build

- name: TypeCheck
if: runner.os == 'Linux'
run: pnpm typecheck

- name: Install xvfb and dependencies
if: ${{ runner.os == 'Linux' && runner.environment == 'self-hosted' }}
- name: Install xvfb and dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb
Expand All @@ -91,9 +98,9 @@ jobs:
uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732
with:
path: packages/vscode-extension/.vscode-test
key: 'vscode-test'
key: vscode-test-${{ matrix.os }}
restore-keys: |
- 'vscode-test-'
vscode-test-${{ matrix.os }}-
- name: Test on Linux
if: runner.os == 'Linux'
Expand All @@ -104,17 +111,19 @@ jobs:
run: pnpm -r test

- name: Check Spell
if: runner.os == 'Linux'
run: pnpm check-spell

- name: Lint
if: runner.os == 'Linux'
run: pnpm run lint

done:
needs:
- test-go
- test-node
if: always()
runs-on: rspack-ubuntu-22.04-large
runs-on: ubuntu-latest
name: CI Done
steps:
- run: exit 1
Expand Down
11 changes: 7 additions & 4 deletions cmd/rslint/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
allowedFiles := []string{}
// Apply file contents if provided
if len(req.FileContents) > 0 {
fs = utils.NewOverlayVFS(fs, req.FileContents)
for file := range req.FileContents {

allowedFiles = append(allowedFiles, file) // Collect allowed files from request
fileContents := make(map[string]string, len(req.FileContents))
for k, v := range req.FileContents {
normalizePath := tspath.NormalizePath(k)
fileContents[normalizePath] = v
allowedFiles = append(allowedFiles, normalizePath)
}
fs = utils.NewOverlayVFS(fs, fileContents)

}

// Initialize rule registry with all available rules
Expand Down
3 changes: 2 additions & 1 deletion cmd/rslint/lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"log"
"os"
"path/filepath"
"strings"
"sync"

Expand Down Expand Up @@ -394,7 +395,7 @@ func findRslintConfig(fs vfs.FS, workingDir string) (string, bool) {

// Strategy 1: Try in the working directory
for _, configName := range defaultConfigs {
configPath := workingDir + "/" + configName
configPath := filepath.Join(workingDir, configName)
if fs.FileExists(configPath) {
return configPath, true
}
Expand Down
27 changes: 9 additions & 18 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package config

import (
"os"
"path/filepath"
"strings"

"github.com/bmatcuk/doublestar/v4"
"github.com/microsoft/typescript-go/shim/tspath"
importPlugin "github.com/web-infra-dev/rslint/internal/plugins/import"
"github.com/web-infra-dev/rslint/internal/rule"
"github.com/web-infra-dev/rslint/internal/rules/adjacent_overload_signatures"
Expand Down Expand Up @@ -362,21 +362,21 @@ func isFileIgnored(filePath string, ignorePatterns []string) bool {

for _, pattern := range ignorePatterns {
// Try matching against normalized path
if matched, err := doublestar.PathMatch(pattern, normalizedPath); err == nil && matched {
if matched, err := doublestar.Match(pattern, normalizedPath); err == nil && matched {
return true
}

// Also try matching against original path for absolute patterns
if normalizedPath != filePath {
if matched, err := doublestar.PathMatch(pattern, filePath); err == nil && matched {
if matched, err := doublestar.Match(pattern, filePath); err == nil && matched {
return true
}
}

// Try Unix-style path for cross-platform compatibility
unixPath := strings.ReplaceAll(normalizedPath, "\\", "/")
if unixPath != normalizedPath {
if matched, err := doublestar.PathMatch(pattern, unixPath); err == nil && matched {
if matched, err := doublestar.Match(pattern, unixPath); err == nil && matched {
return true
}
}
Expand All @@ -386,25 +386,16 @@ func isFileIgnored(filePath string, ignorePatterns []string) bool {

// normalizePath converts file path to be relative to cwd for consistent matching
func normalizePath(filePath, cwd string) string {
cleanPath := filepath.Clean(filePath)

// If absolute path, try to make it relative to working directory
if filepath.IsAbs(cleanPath) {
if relPath, err := filepath.Rel(cwd, cleanPath); err == nil {
// Only use relative path if it doesn't go outside the working directory
if !strings.HasPrefix(relPath, "..") {
return relPath
}
}
}

return cleanPath
return tspath.NormalizePath(tspath.ConvertToRelativePath(filePath, tspath.ComparePathsOptions{
UseCaseSensitiveFileNames: true,
CurrentDirectory: cwd,
}))
}

// isFileIgnoredSimple provides fallback matching when cwd is unavailable
func isFileIgnoredSimple(filePath string, ignorePatterns []string) bool {
for _, pattern := range ignorePatterns {
if matched, err := doublestar.PathMatch(pattern, filePath); err == nil && matched {
if matched, err := doublestar.Match(pattern, filePath); err == nil && matched {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/config/cwd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestDoublestarBehavior(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
matched, err := doublestar.PathMatch(tt.pattern, tt.path)
matched, err := doublestar.Match(tt.pattern, tt.path)
if err != nil {
t.Errorf("doublestar.PathMatch error: %v", err)
return
Expand Down
Loading