From 9d47f7f25537e9725c4e3531459aa51ba35c1557 Mon Sep 17 00:00:00 2001 From: "Hana (Hyang-Ah) Kim" Date: Fri, 13 Mar 2020 17:37:52 -0400 Subject: [PATCH 1/2] github/workflow: daily release workflow Daily release workflow is triggered everyday between Mon-Thu, 15:00 UTC (11am EDT). This prepares the version string through local modification on package.json and runs the tests again before publishing. The newly released version has the version string computed based on the last git commit's commit timestamp. ..- That means, if there is no commit since the last release, the publishing step will fail (because the MS VS Code extension market will detect the identical version). --- .github/workflows/release.yml | 85 +++++++++++++++++++++++++++++++++++ build/all.bash | 25 ++++++++++- package.json | 2 +- 3 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..c9ec2ebd3d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: release + +# Daily release on 15:00 UTC, monday-thursday. +# Or, force to release by triggering repository_dispatch events by using +# curl -v -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/golang/vscode-go/dispatches -d '{ "event_type": "force-release" }' +on: + schedule: + - cron: "0 15 * * MON-THU" # 15 UTC, monday-thursday daily + repository_dispatch: + types: [force-release] + +env: + GOPATH: /tmp/go + # Because some tests require explicit setting of GOPATH. TODO: FIX THEM. + +jobs: + release: + name: Release Nightly + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Clone repository + uses: actions/checkout@v1 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '10.x' + + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: '1.14' + + - name: Install dependencies + run: npm ci + + - name: Install Go tools (Modules mode) + run: | + go version + go get github.com/acroca/go-symbols \ + github.com/davidrjenni/reftools/cmd/fillstruct \ + github.com/haya14busa/goplay/cmd/goplay \ + github.com/mdempsky/gocode \ + github.com/sqs/goreturns \ + github.com/uudashr/gopkgs/v2/cmd/gopkgs \ + github.com/zmb3/gogetdoc \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/gorename + env: + GO111MODULE: on + + - name: Install Go tools (GOPATH mode) + run: | + go version + go get github.com/cweill/gotests/... \ + github.com/rogpeppe/godef \ + github.com/ramya-rao-a/go-outline + # Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM. + env: + GO111MODULE: off + + - name: Prepare Release + run: build/all.bash prepare_nightly + + - name: Run unit tests + run: npm run unit-test + continue-on-error: true + + - name: Run tests + uses: GabrielBB/xvfb-action@v1.0 + with: + run: npm run test + env: + CODE_VERSION: ${{ matrix.version }} + continue-on-error: ${{ matrix.version == 'insiders' }} + + - name: Publish + if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go' + uses: lannonbr/vsce-action@704da577da0f27de5cdb4ae018374c2f08b5f523 + with: + args: "publish -p $VSCE_TOKEN" + env: + VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} diff --git a/build/all.bash b/build/all.bash index 1a8e4a8f7c..f4e65931d8 100755 --- a/build/all.bash +++ b/build/all.bash @@ -51,6 +51,26 @@ run_test_in_docker() { docker run --workdir=/workspace -v "$(pwd):/workspace" vscode-test-env ci } +prepare_nightly() { + local VER=`git log -1 --format=%cd-%h --date="format:%Y.%-m.%-d"` + echo "**** Preparing nightly release : $VER ***" + + # Update package.json + (cat package.json | jq --arg VER "${VER}" ' +.version=$VER | +.preview=true | +.name="go-nightly" | +.displayName="Go Nightly" | +.publisher="golang" | +.description="Rich Go language support for Visual Studio Code (Nightly)" | +.author.name="Go Team at Google" | +.repository.url="https://github.com/golang/vscode-go" | +.bugs.url="https://github.com/golang/vscode-go/issues" +') > /tmp/package.json && mv /tmp/package.json package.json + + # TODO(hyangah): Update README.md and CHANGELOG.md +} + main() { cd "$(root_dir)" # always run from the script root. case "$1" in @@ -70,9 +90,12 @@ main() { setup_virtual_display run_test ;; + "prepare_nightly") + prepare_nightly + ;; *) usage exit 2 esac } -main $@ \ No newline at end of file +main $@ diff --git a/package.json b/package.json index 26fa823b8d..fac30acc15 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "go-nightly", "displayName": "Go Nightly", - "version": "2020.3.144", + "version": "0.0.0-development", "publisher": "golang", "description": "Rich Go language support for Visual Studio Code (Nightly)", "author": { From b888148a09251f7012136653d7f705d5ef4d1fde Mon Sep 17 00:00:00 2001 From: "Hana (Hyang-Ah) Kim" Date: Wed, 18 Mar 2020 10:32:02 -0400 Subject: [PATCH 2/2] github/workflows: address comments from golang.org/cl/223677 - remove extra white spaces - remove orphaned reference of matrix - make it use VS Code Insiders for testing --- .github/workflows/release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9ec2ebd3d..809a829194 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,8 +49,8 @@ jobs: golang.org/x/lint/golint \ golang.org/x/tools/cmd/gorename env: - GO111MODULE: on - + GO111MODULE: on + - name: Install Go tools (GOPATH mode) run: | go version @@ -60,21 +60,20 @@ jobs: # Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM. env: GO111MODULE: off - + - name: Prepare Release run: build/all.bash prepare_nightly - name: Run unit tests run: npm run unit-test continue-on-error: true - + - name: Run tests uses: GabrielBB/xvfb-action@v1.0 with: run: npm run test env: - CODE_VERSION: ${{ matrix.version }} - continue-on-error: ${{ matrix.version == 'insiders' }} + CODE_VERSION: 'insiders' - name: Publish if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go'