Skip to content

Commit f8e5203

Browse files
Merge pull request #14920 from WojciechMazur/feature/integrate-with-unmanaged-cb
Setup integration with the unmanaged community build
2 parents 7f53f4b + f494124 commit f8e5203

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,44 @@ jobs:
561561
external_repository: lampepfl/dotty-website
562562
publish_branch: gh-pages
563563

564+
nightly_unmanaged_community_build:
565+
# Self-hosted runner is used only for getting current build version
566+
runs-on: [self-hosted, Linux]
567+
container:
568+
image: lampepfl/dotty:2021-03-22
569+
options: --cpu-shares 4096
570+
volumes:
571+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
572+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
573+
- ${{ github.workspace }}/../../cache/general:/root/.cache
574+
needs: [publish_nightly]
575+
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.repository == 'lampepfl/dotty'"
576+
env:
577+
NIGHTLYBUILD: yes
578+
steps:
579+
- name: Reset existing repo
580+
run: git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true
581+
582+
- name: Checkout cleanup script
583+
uses: actions/checkout@v2
584+
585+
- name: Cleanup
586+
run: .github/workflows/cleanup.sh
587+
588+
- name: Git Checkout
589+
uses: actions/checkout@v2
590+
591+
- name: Add SBT proxy repositories
592+
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
593+
594+
- name: Get version string for this build
595+
run: |
596+
ver=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
597+
echo "This build version: $ver"
598+
echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV
599+
# Steps above are copy-pasted from publish_nightly, needed only to resolve THISBUILD_VERSION
600+
- name: Trigger unmanaged community build
601+
run: .github/workflows/scripts/triggerUnmanagedCommunityBuild.sh "${{ secrets.BUILD_TOKEN }}" "$THISBUILD_VERSION"
564602

565603
publish_release:
566604
runs-on: [self-hosted, Linux]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# This is script for triggering unamanged community build upon releasing nightly version.
4+
# Script sends request to CB Jenkins instance to start the build for given released Scala version
5+
# Prints url of created job to stdout
6+
#
7+
# Requirement:
8+
# - the latest (nightly) version of scala should be published
9+
10+
set -u
11+
12+
if [ $# -ne 2 ]; then
13+
echo "Wrong number of script arguments, expected <token> <scala-version>, got $#: $@"
14+
exit 1
15+
fi
16+
17+
CB_ENDPOINT=https://scala3.westeurope.cloudapp.azure.com
18+
CB_BUILD_TOKEN="$1"
19+
SCALA_VERSION="$2"
20+
21+
startRunResponse=$(curl "${CB_ENDPOINT}/job/runBuild/buildWithParameters?token=${CB_BUILD_TOKEN}&publishedScalaVersion=${SCALA_VERSION}" -v 2>&1)
22+
echo "${startRunResponse}"
23+
queueItem=$(echo "${startRunResponse}" | grep -oP "< Location: \K[\w\d:/.//]+")
24+
# Wait until Jenkins does acknowledge the build (max 1 min )
25+
for i in {1..12}; do
26+
buildUrl=$(curl -s "${queueItem}/api/json?tree=executable[url]" | jq .executable.url)
27+
if [[ "null" == "${buildUrl}" ]]; then
28+
echo "Waiting for build start..."
29+
sleep 5
30+
else
31+
echo "Created build url: ${buildUrl}"
32+
exit 0
33+
fi
34+
done
35+
36+
# Set error if failed to resolve build url
37+
exit 1

0 commit comments

Comments
 (0)