blob: 7bd0271325da0824409806e62af8d71e8d23878e [file] [log] [blame]
# Generated by internal/ci/ci_tool.cue; do not edit
name: Test
on:
push:
branches:
- '**'
tags-ignore:
- v*
jobs:
start:
runs-on: ubuntu-18.04
defaults:
run:
shell: bash
steps:
- if: ${{ startsWith(github.ref, 'refs/heads/ci/') }}
name: Write the gitcookies file
run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies
- if: ${{ startsWith(github.ref, 'refs/heads/ci/') }}
name: Update Gerrit CL message with starting message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Started
the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename
$(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review'
test:
needs: start
strategy:
fail-fast: false
matrix:
go-version:
- 1.14.14
- 1.15.8
- "1.16"
os:
- ubuntu-18.04
- macos-10.15
- windows-2019
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Write the gitcookies file
run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum')
}}
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- if: ${{ github.ref == 'refs/heads/master' }}
name: Set go build tags
run: go env -w GOFLAGS=-tags=long
- if: matrix.go-version == '1.14.14' && matrix.os != 'windows-2019'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ci/')
&& matrix.go-version == '1.15.8' && matrix.os == 'ubuntu-18.04' }}
name: Test with -race
run: go test -race ./...
- name: gorelease check
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- if: ${{ github.ref == 'refs/heads/master' }}
name: Pull this commit through the proxy on master
run: |-
v=$(git rev-parse HEAD)
cd $(mktemp -d)
go mod init mod.com
GOPROXY=https://proxy.golang.org go get -d cuelang.org/go/cmd/cue@$v
- if: ${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}
name: Post any failures for this matrix entry
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build
failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url
}}/actions/runs/${{ github.run_id }} for more details","labels":{"Code-Review":-1}}''
-b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename
$(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review'
mark_ci_success:
runs-on: ubuntu-18.04
if: ${{ startsWith(github.ref, 'refs/heads/ci/') }}
needs: test
defaults:
run:
shell: bash
steps:
- name: Write the gitcookies file
run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies
- name: Update Gerrit CL message with success message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build
succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id
}}","labels":{"Code-Review":1}}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename
$(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review'
delete_build_branch:
runs-on: ubuntu-18.04
if: ${{ startsWith(github.ref, 'refs/heads/ci/') && always() }}
needs: test
defaults:
run:
shell: bash
steps:
- run: |-
mkdir tmpgit
cd tmpgit
git init
git config user.name cueckoo
git config user.email cueckoo@gmail.com
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)"
git push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/}