diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 0000000..7c0219b --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,42 @@ +name: CI for Windows + +on: + pull_request: + push: + branches: [main] + +jobs: + + build: + runs-on: windows-latest + + steps: + - name: Prepare git + run: git config --global core.autocrlf false + + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Build + run: go build -v ./... + + - name: Checkout dummy repo + uses: actions/checkout@v2 + with: + repository: seachicken/can + path: ci-test + fetch-depth: 0 + + - name: Test + working-directory: ./ci-test + run: | + foreach ($branch in $(git branch --all | findstr /r '\<\s*remotes' | findstr /v /r 'main$')) { + git branch --track $(echo $branch | Select-String -Pattern '.+/(.+$)' | %{$_.matches.groups[1].Value}) "$branch".trim() + } + echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + go test .. -v + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ca923b..2b7f959 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,6 @@ jobs: runs-on: ${{ matrix.os }} steps: - - name: Prepare git - run: git config --global core.autocrlf false - - uses: actions/checkout@v2 - name: Set up Go @@ -38,7 +35,10 @@ jobs: - name: Test working-directory: ./ci-test run: | - for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|main)$'); do git branch --track "${branch##*/}" "$branch"; done + for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match 'main$') + do + git branch --track "${branch##*/}" "$branch" + done echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token go test .. -v -race -coverprofile=coverage.out -covermode=atomic