From 69d79645518dc37fa4ffc1a029e25b261a745c23 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 12 Apr 2022 19:58:39 +0200 Subject: [PATCH 1/3] Setup integration with unmanaged community build --- .github/workflows/ci.yaml | 4 ++ .../scripts/triggerUnmanagedCommunityBuild.sh | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 .github/workflows/scripts/triggerUnmanagedCommunityBuild.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 91add81f44ae..6fc1d44711bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -551,6 +551,10 @@ jobs: run: | ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease" + - name: Trigger unmanaged community build + continue-on-error: true + run: .github/workflows/scripts/triggerUnmanagedCommunityBuild.sh "${{ secrets.BUILD_TOKEN }}" "$THISBUILD_VERSION" + nightly_documentation: runs-on: [self-hosted, Linux] container: diff --git a/.github/workflows/scripts/triggerUnmanagedCommunityBuild.sh b/.github/workflows/scripts/triggerUnmanagedCommunityBuild.sh new file mode 100755 index 000000000000..694428e29bb5 --- /dev/null +++ b/.github/workflows/scripts/triggerUnmanagedCommunityBuild.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# This is script for triggering unamanged community build upon releasing nightly version. +# Script sends request to CB Jenkins instance to start the build for given released Scala version +# Prints url of created job to stdout +# +# Requirement: +# - the latest (nightly) version of scala should be published + +set -u + +if [ $# -ne 2 ]; then + echo "Wrong number of script arguments, expected , got $#: $@" + exit 1 +fi + +CB_ENDPOINT=https://scala3.westeurope.cloudapp.azure.com +CB_BUILD_TOKEN="$1" +SCALA_VERSION="$2" + +startRunResponse=$(curl "${CB_ENDPOINT}/job/runBuild/buildWithParameters?token=${CB_BUILD_TOKEN}&publishedScalaVersion=${SCALA_VERSION}" -v 2>&1) +echo "${startRunResponse}" +queueItem=$(echo "${startRunResponse}" | grep -oP "< Location: \K[\w\d:/.//]+") +# Wait until Jenkins does acknowledge the build (max 1 min ) +for i in {1..12}; do + buildUrl=$(curl -s "${queueItem}/api/json?tree=executable[url]" | jq .executable.url) + if [[ "null" == "${buildUrl}" ]]; then + echo "Waiting for build start..." + sleep 5 + else + echo "Created build url: ${buildUrl}" + exit 0 + fi +done + +# Set error if failed to resolve build url +exit 1 From e68e60f835139ab63ec71faa88830e4aa64ac9fb Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 19 Apr 2022 14:12:46 +0200 Subject: [PATCH 2/3] Move Commnity Build trigger to seperate job --- .github/workflows/ci.yaml | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6fc1d44711bb..fbd5a4a101cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -551,10 +551,6 @@ jobs: run: | ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease" - - name: Trigger unmanaged community build - continue-on-error: true - run: .github/workflows/scripts/triggerUnmanagedCommunityBuild.sh "${{ secrets.BUILD_TOKEN }}" "$THISBUILD_VERSION" - nightly_documentation: runs-on: [self-hosted, Linux] container: @@ -604,6 +600,41 @@ jobs: external_repository: lampepfl/dotty-website publish_branch: gh-pages + nightly_unmanaged_community_build: + # Self-hosted runner is used only for getting current build version + runs-on: [self-hosted, Linux] + container: + image: lampepfl/dotty:2021-03-22 + options: --cpu-shares 4096 + volumes: + - ${{ github.workspace }}/../../cache/sbt:/root/.sbt + - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache + - ${{ github.workspace }}/../../cache/general:/root/.cache + needs: [publish_nightly] + steps: + - name: Reset existing repo + run: git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true + + - name: Checkout cleanup script + uses: actions/checkout@v2 + + - name: Cleanup + run: .github/workflows/cleanup.sh + + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Add SBT proxy repositories + run: cp -vf .github/workflows/repositories /root/.sbt/ ; true + + - name: Get version string for this build + run: | + ver=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1) + echo "This build version: $ver" + echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV + # Steps above are copy-pasted from publish_nightly, needed only to resolve THISBUILD_VERSION + - name: Trigger unmanaged community build + run: .github/workflows/scripts/triggerUnmanagedCommunityBuild.sh "${{ secrets.BUILD_TOKEN }}" "$THISBUILD_VERSION" publish_release: runs-on: [self-hosted, Linux] From f4941244970a74d2f580fffb27637e7681e9e739 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 20 Apr 2022 09:56:15 +0200 Subject: [PATCH 3/3] Add missing env variable --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fbd5a4a101cf..422da26aa465 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -611,6 +611,9 @@ jobs: - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache - ${{ github.workspace }}/../../cache/general:/root/.cache needs: [publish_nightly] + if: "(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.repository == 'lampepfl/dotty'" + env: + NIGHTLYBUILD: yes steps: - name: Reset existing repo run: git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true