From b6582db4c0965839f4b6357e1d8a0d1d7e267193 Mon Sep 17 00:00:00 2001 From: Zhou Cheng Date: Mon, 12 Aug 2024 11:52:31 +0800 Subject: [PATCH] CI: fix windows test (#5077) --- .github/workflows/wintest.yml | 104 ++++++++++++++++------------------ 1 file changed, 50 insertions(+), 54 deletions(-) diff --git a/.github/workflows/wintest.yml b/.github/workflows/wintest.yml index 4f1d8332d87c..ce7cf67aed7b 100644 --- a/.github/workflows/wintest.yml +++ b/.github/workflows/wintest.yml @@ -1,20 +1,21 @@ -name: "test jfs on windows" +name: "wintest" on: push: branches: + - 'main' - 'release-**' - paths-ignore: - - 'docs/**' - - '**.md' + paths: + - '**/wintest.yml' pull_request: - #The branches below must be a subset of the branches above branches: + - 'main' - 'release-**' - paths-ignore: - - 'docs/**' - - '**.md' + paths: + - '**/wintest.yml' workflow_dispatch: + schedule: + - cron: '0 0 * * 0' jobs: wintest: @@ -25,34 +26,24 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 'oldstable' + go-version: '1.21' - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 1 - - name: Setup MSBuild.exe + if: false uses: microsoft/setup-msbuild@v1.0.3 - name: Change Winsdk Version + if: false uses: GuillaumeFalourd/setup-windows10-sdk-action@v1 with: sdk-version: 18362 - - name: Cache WinFsp - id: Cache-WinFsp - uses: actions/cache@v3 - with: - path: 'C:\wfsp\' - key: ${{ runner.os }}-winfsp-key - restore-keys: | - ${{ runner.os }}-winfsp - - - name: Download WinFsp - if: steps.Cache-WinFsp.outputs.cache-hit != 'true' run: | choco install wget mkdir "C:\wfsp\" @@ -63,8 +54,6 @@ jobs: run: | msiexec.exe /i "C:\wfsp\winfsp.msi" /qn /norestart INSTALLLEVEL=1000 - - - name: Set up Include Headers run: | mkdir "C:\WinFsp\inc\fuse" @@ -75,8 +64,7 @@ jobs: go env -w CGO_CFLAGS=-IC:/WinFsp/inc/fuse go env - - - name: Install Scoop Redis and MinIO + - name: Install Scoop run: | dir "C:\Program Files (x86)\WinFsp" Set-ExecutionPolicy RemoteSigned -scope CurrentUser @@ -84,11 +72,18 @@ jobs: .\install.ps1 -RunAsAdmin echo $env:USERNAME scoop - scoop install curl scoop install redis scoop install minio@2021-12-10T23-03-39Z scoop install runasti - curl https://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/2.9.0/winsw-2.9.0-net4.exe -o redis-service.exe + + - name: Download winsw + run: | + wget https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe -O winsw.exe + ls winsw.exe + + - name: Start Redis + run: | + copy winsw.exe redis-service.exe echo "" >> redis-service.xml echo "redisredis" >> redis-service.xml echo "redisredis" >> redis-service.xml @@ -98,7 +93,10 @@ jobs: echo "" >> redis-service.xml .\redis-service.exe install net start redisredis - curl https://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/2.9.0/winsw-2.9.0-net4.exe -o minio-service.exe + + - name: Start Minio + run: | + copy winsw.exe minio-service.exe mkdir "C:\tmp" echo "" >> minio-service.xml echo "MinIO" >> minio-service.xml @@ -111,15 +109,6 @@ jobs: .\minio-service.exe install net start MinIO - - uses: actions/cache@v3 - with: - path: | - ~\AppData\Local\go-build - ~\go\pkg\mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build Juicefs run: | go build -ldflags="-s -w" -o juicefs.exe . @@ -131,17 +120,25 @@ jobs: - name: Juicefs Mount run: | echo "C:\Program Files (x86)\WinFsp\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - curl https://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/2.9.0/winsw-2.9.0-net4.exe -o juicefs-service.exe + copy winsw.exe juicefs-service.exe echo "" >> juicefs-service.xml - echo "jfs" >> juicefs-service.xml - echo "jfs" >> juicefs-service.xml - echo "jfs" >> juicefs-service.xml + echo "juicefs" >> juicefs-service.xml + echo "juicefs" >> juicefs-service.xml + echo "juicefs" >> juicefs-service.xml echo "$PWD\juicefs.exe" >> juicefs-service.xml echo "mount redis://127.0.0.1:6379/1 Z: --no-usage-report" >> juicefs-service.xml echo "rotate" >> juicefs-service.xml echo "" >> juicefs-service.xml .\juicefs-service.exe install - net start jfs + net start juicefs + + - name: Test Juicefs + run: | + mkdir "Z:\dir" + dir "Z:\dir" + echo "hello" > "Z:\dir\hello.txt" + dir "Z:\dir\hello.txt" + # type "Z:\dir\hello.txt" #there is go-fuse compile error with unit test #- name: Unit Test @@ -151,18 +148,17 @@ jobs: # rm pkg/meta/tkv_test.go # go test -v -cover ./pkg/... ./cmd/... - - - name: Install Python2 - run: | - choco install python2 -y - - - name: Build and Run Winfstest - run: | - git clone https://github.com/sanwan/winfstest.git - cd winfstest - msbuild.exe winfstest.sln - cd TestSuite - .\run-winfstest + # - name: Install Python2 + # run: | + # choco install python2 -y + + # - name: Build and Run Winfstest + # run: | + # git clone https://github.com/sanwan/winfstest.git + # cd winfstest + # msbuild.exe winfstest.sln + # cd TestSuite + # .\run-winfstest #cannot write file because of some permission question with winfsp #- name: Build and Run Winfstest in Jfs Directory