summaryrefslogtreecommitdiffstats
path: root/.github/workflows/test.yml
blob: 734411b3502bb1ff115b48ccd7918876ce6e42c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
on:
  push:
    branches: [master]
  pull_request:
name: Test
env:
  GOPROXY: https://proxy.golang.org
  GO111MODULE: on
  SASS_VERSION: 1.63.2
  DART_SASS_SHA_LINUX: 3ea33c95ad5c35fda6e9a0956199eef38a398f496cfb8750e02479d7d1dd42af
  DART_SASS_SHA_MACOS: 11c70f259836b250b44a9cb57fed70e030f21f45069b467d371685855f1eb4f0
  DART_SASS_SHA_WINDOWS: cd8cd36a619dd8e27f93d3186c52d70eb7d69472aa6c85f5094b29693e773f64
permissions:
  contents: read
jobs:
  test:
    strategy:
      matrix:
        go-version: [1.21.x, 1.22.x]
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - if: matrix.os == 'ubuntu-latest'
        name: Free Disk Space (Ubuntu)
        uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
        with:
          # this might remove tools that are actually needed,
          # if set to "true" but frees about 6 GB
          tool-cache: false
          android: true
          dotnet: true
          haskell: true
          large-packages: true
          docker-images: true
          swap-storage: true
      - name: Checkout code
        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
      - name: Install Go
        uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
        with:
          go-version: ${{ matrix.go-version }}
          check-latest: true
          cache: true
          cache-dependency-path: |
            **/go.sum
            **/go.mod
      - name: Install Ruby
        uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899
        with:
          ruby-version: "2.7"
          bundler-cache: true #
      - name: Install Python
        uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
        with:
          python-version: "3.x"
      - name: Install Mage
        run: go install github.com/magefile/mage@v1.15.0
      - name: Install asciidoctor
        uses: reitzig/actions-asciidoctor@03fcc74cd74880b697950c4930c9ec8a67c69ecc
      - name: Install docutils
        run: |
          pip install docutils
          rst2html --version
      - if: matrix.os == 'ubuntu-latest'
        name: Install pandoc on Linux
        run: |
          sudo apt-get update -y
          sudo apt-get install -y pandoc
      - if: matrix.os == 'macos-latest'
        run: |
          brew install pandoc
      - if: matrix.os == 'windows-latest'
        run: |
          choco install pandoc
      - run: pandoc -v
      - if: matrix.os == 'windows-latest'
        run: |
          choco install mingw
      - if: matrix.os == 'ubuntu-latest'
        name: Install dart-sass Linux
        run: |
          echo "Install Dart Sass version ${SASS_VERSION} ..."
          curl -LJO "https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-x64.tar.gz";
          echo "${DART_SASS_SHA_LINUX}  dart-sass-${SASS_VERSION}-linux-x64.tar.gz" | sha256sum -c;
          tar -xvf "dart-sass-${SASS_VERSION}-linux-x64.tar.gz";
          echo "$GOBIN"
          echo "$GITHUB_WORKSPACE/dart-sass/" >> $GITHUB_PATH
      - if: matrix.os == 'macos-latest'
        name: Install dart-sass MacOS
        run: |
          echo "Install Dart Sass version ${SASS_VERSION} ..."
          curl -LJO "https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-macos-x64.tar.gz";
          echo "${DART_SASS_SHA_MACOS}  dart-sass-${SASS_VERSION}-macos-x64.tar.gz" | shasum -a 256 -c;
          tar -xvf "dart-sass-${SASS_VERSION}-macos-x64.tar.gz";
          echo "$GITHUB_WORKSPACE/dart-sass/" >> $GITHUB_PATH
      - if: matrix.os == 'windows-latest'
        name: Install dart-sass Windows
        run: |
          echo "Install Dart Sass version ${env:SASS_VERSION} ..."
          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  "$env:GITHUB_WORKSPACE/dart-sass/" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf-8 -Append
      - if: matrix.os == 'ubuntu-latest'
        name: Install staticcheck
        run: go install honnef.co/go/tools/cmd/staticcheck@latest
      - if: matrix.os == 'ubuntu-latest'
        name: Run staticcheck
        run: staticcheck ./...
      - if: matrix.os != 'windows-latest'
        name: Check
        run: |
          sass --version;
          mage -v check;
        env:
          HUGO_BUILD_TAGS: extended
      - if: matrix.os == 'windows-latest'
        # See issue #11052. We limit the build to regular test (no -race flag) on Windows for now.
        name: Test
        run: |
          mage -v test;
        env:
          HUGO_BUILD_TAGS: extended
      - name: Build tags
        run: |
          go install -tags extended,nodeploy
      - if: matrix.os == 'ubuntu-latest'
        name: Build for dragonfly
        run: |
          go install
        env:
          GOARCH: amd64
          GOOS: dragonfly