Skip to content

Commit

Permalink
github: Bump Go and Sass versions, add Staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jul 11, 2024
1 parent 7e0d8b1 commit 4610ee4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ on:
pull_request:
name: Test
env:
SASS_VERSION: 1.63.2
SASS_VERSION: 1.77.5
jobs:
test:
strategy:
matrix:
go-version: [~1.19, ~1.20]
go-version: [1.21.x, 1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install dart-sass Linux
if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -38,6 +40,8 @@ jobs:
curl -LJO "https://github.com/sass/dart-sass/releases/download/${env:SASS_VERSION}/dart-sass-${env:SASS_VERSION}-windows-x64.zip";
Expand-Archive -Path "dart-sass-${env:SASS_VERSION}-windows-x64.zip" -DestinationPath .;
echo "DART_SASS_BINARY=$env:GITHUB_WORKSPACE/dart-sass/sass.bat" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Staticcheck
run: staticcheck ./...
- name: Test
run: go test -race . -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage
Expand Down
3 changes: 1 addition & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func (c conn) Start() error {

// Close closes conn's WriteCloser, ReadClosers, and waits for the command to finish.
func (c conn) Close() error {

writeErr := c.WriteCloser.Close()
readErr := c.readerCloser.Close()
var interruptErr error
Expand Down Expand Up @@ -106,7 +105,7 @@ func (c conn) waitWithTimeout() error {

}
return err
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
return errors.New("timed out waiting for dart-sass to finish")
}
}
Expand Down
24 changes: 5 additions & 19 deletions transpiler_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package godartsass_test

import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -63,7 +61,6 @@ func (t testImportResolver) Load(url string) (godartsass.Import, error) {
panic("protocol error")
}
return godartsass.Import{Content: t.content, SourceSyntax: t.sourceSyntax}, nil

}

func TestTranspilerVariants(t *testing.T) {
Expand Down Expand Up @@ -179,19 +176,17 @@ body {
}

func TestIncludePaths(t *testing.T) {
dir1, _ := ioutil.TempDir(os.TempDir(), "libsass-test-include-paths-dir1")
defer os.RemoveAll(dir1)
dir2, _ := ioutil.TempDir(os.TempDir(), "libsass-test-include-paths-dir2")
defer os.RemoveAll(dir2)
dir1 := t.TempDir()
dir2 := t.TempDir()

colors := filepath.Join(dir1, "_colors.scss")
content := filepath.Join(dir2, "_content.scss")

ioutil.WriteFile(colors, []byte(`
os.WriteFile(colors, []byte(`
$moo: #f442d1 !default;
`), 0o644)

ioutil.WriteFile(content, []byte(`
os.WriteFile(content, []byte(`
content { color: #ccc; }
`), 0o644)

Expand Down Expand Up @@ -330,7 +325,6 @@ div { color: $primary-color; }`, gor)
wg.Wait()

c.Assert(transpiler.IsShutDown(), qt.Equals, true)

}

func BenchmarkTranspiler(b *testing.B) {
Expand Down Expand Up @@ -414,7 +408,7 @@ func TestVersion(t *testing.T) {
version, err := godartsass.Version(getSassEmbeddedFilename())
c.Assert(err, qt.IsNil)
c.Assert(version, qt.Not(qt.Equals), "")
c.Assert(version.ProtocolVersion, qt.Equals, "2.0.0")
c.Assert(version.ProtocolVersion, qt.Equals, "2.7.1")
}

func newTestTranspiler(c *qt.C, opts godartsass.Options) (*godartsass.Transpiler, func()) {
Expand All @@ -436,11 +430,3 @@ func getSassEmbeddedFilename() string {

return "sass"
}

// used for debugging
func printJSON(s string) {
m := make(map[string]interface{})
json.Unmarshal([]byte(s), &m)
b, _ := json.MarshalIndent(m, "", " ")
fmt.Printf("%s", b)
}

0 comments on commit 4610ee4

Please sign in to comment.