Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Github Actions #119

Merged
merged 160 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
40e2be5
Restore verbose misiing module mapping info used for controlling usag…
WojciechMazur May 3, 2022
dcb4ed2
Fix logic for handling cyclic deps
WojciechMazur Oct 8, 2022
9ed43df
Update config
WojciechMazur Jan 9, 2023
ea6a7f1
async coordinator
WojciechMazur Jan 9, 2023
6f07a90
Update scripts
WojciechMazur Jan 9, 2023
37449bb
Add VL/scala-open-source group
WojciechMazur Jan 9, 2023
6233a80
test build
WojciechMazur Jan 9, 2023
f76f883
limit jobs
WojciechMazur Jan 9, 2023
dd50bd8
use names only
WojciechMazur Jan 10, 2023
8a6a8cb
try build
WojciechMazur Jan 10, 2023
8e60d81
debug
WojciechMazur Jan 10, 2023
22e1708
debug
WojciechMazur Jan 10, 2023
291279a
debug
WojciechMazur Jan 10, 2023
af11112
quote project names
WojciechMazur Jan 10, 2023
9232272
fix image selection
WojciechMazur Jan 10, 2023
83340ab
debug
WojciechMazur Jan 10, 2023
559e04f
debug
WojciechMazur Jan 10, 2023
0ec6745
try fix bash function definition
WojciechMazur Jan 10, 2023
8c86b0b
try other syntax for functions
WojciechMazur Jan 10, 2023
fb4b6fc
try debug
WojciechMazur Jan 10, 2023
4c392c3
debug
WojciechMazur Jan 10, 2023
23f7d25
try fix checking result
WojciechMazur Jan 10, 2023
a09c873
try debug
WojciechMazur Jan 10, 2023
1d490d1
delay checking build result
WojciechMazur Jan 10, 2023
834e305
Store artifacts
WojciechMazur Jan 10, 2023
c5ae7e8
Fix typo
WojciechMazur Jan 10, 2023
d8779b8
Use unique names for artifacts
WojciechMazur Jan 10, 2023
1a9d3f5
try simplified build
WojciechMazur Jan 10, 2023
aca9859
Set default memory request if missing at action level
WojciechMazur Jan 10, 2023
b1da1a1
Setup build config auto-updates
WojciechMazur Jan 10, 2023
9589e9e
fix installation of scalacli
WojciechMazur Jan 10, 2023
92c8dbd
Test other half of the build
WojciechMazur Jan 10, 2023
9b3e500
fix empty matrix
WojciechMazur Jan 10, 2023
9053852
fix empty matrix
WojciechMazur Jan 10, 2023
76c1f03
try build compiler
WojciechMazur Jan 11, 2023
65487cb
try fix build
WojciechMazur Jan 11, 2023
3ca4a5d
try fix build
WojciechMazur Jan 11, 2023
fbded0f
try fix
WojciechMazur Jan 11, 2023
69569ed
try fix
WojciechMazur Jan 11, 2023
cc34f6b
try fix
WojciechMazur Jan 11, 2023
a82203c
try fix
WojciechMazur Jan 11, 2023
58cad03
try fix
WojciechMazur Jan 11, 2023
761766c
add feeding elastic
WojciechMazur Jan 11, 2023
c7912e3
try fix
WojciechMazur Jan 11, 2023
e953483
fix
WojciechMazur Jan 11, 2023
50a8e40
try fix
WojciechMazur Jan 11, 2023
4ecca8f
try fix
WojciechMazur Jan 11, 2023
a49c8ac
fix loop
WojciechMazur Jan 11, 2023
c4f27ce
try fix
WojciechMazur Jan 11, 2023
6cbb99e
try fix build
WojciechMazur Jan 11, 2023
ea3cc4c
set es creads
WojciechMazur Jan 11, 2023
d908c93
pass es auth by input
WojciechMazur Jan 11, 2023
d91e735
fix typo
WojciechMazur Jan 11, 2023
9e56ce9
debug
WojciechMazur Jan 11, 2023
1569160
fix env
WojciechMazur Jan 11, 2023
55477ef
debug
WojciechMazur Jan 11, 2023
b247a61
try debug
WojciechMazur Jan 11, 2023
b3e6b75
fix es inputs
WojciechMazur Jan 11, 2023
dc7dead
fix build skip detection
WojciechMazur Jan 11, 2023
4881704
fix detection skippable builds
WojciechMazur Jan 11, 2023
9045e75
fix
WojciechMazur Jan 11, 2023
d43df43
fix cond
WojciechMazur Jan 11, 2023
e2fe876
remove sample repos
WojciechMazur Jan 12, 2023
79afb9b
Try local ./mill instance only if it exists
WojciechMazur Jan 12, 2023
b0a7f41
Don't set publishVersion in sbt when not publishing
WojciechMazur Jan 12, 2023
e87c817
Remove Jenkins
WojciechMazur Jan 12, 2023
57107bc
Use scala-cli in coordinator instead of sbt
WojciechMazur Jan 12, 2023
d0f0c55
Don't build coordinator image
WojciechMazur Jan 12, 2023
57ec9c3
Allow to build with JDK 19
WojciechMazur Jan 12, 2023
fcba0ee
Use public instance of ES to create raports
WojciechMazur Jan 12, 2023
3b66d96
Update configs
WojciechMazur Jan 12, 2023
ed16a0a
Use GithubActions as a main CI for OpenCB
WojciechMazur Jan 12, 2023
94f8f9f
Setup weekly builds
WojciechMazur Jan 12, 2023
68b904c
Merge branch 'VirtusLab:master' into master
WojciechMazur Jan 12, 2023
788fd3a
Merge remote-tracking branch 'origin/master' into fix/cooridnator-cyc…
WojciechMazur Jan 12, 2023
d2d3489
Merge remote-tracking branch 'private/master' into fix/cooridnator-cy…
WojciechMazur Jan 12, 2023
057f906
Merge pull request #2 from WojciechMazur/fix/cooridnator-cyclic-projects
WojciechMazur Jan 12, 2023
7055470
Fix workflows
WojciechMazur Jan 12, 2023
49594b6
fix weeklyb uild
WojciechMazur Jan 12, 2023
98575cd
try fix builds
WojciechMazur Jan 12, 2023
47c7c88
try fix weekly build
WojciechMazur Jan 12, 2023
088eb86
Fix gha-jobid action version
WojciechMazur Jan 12, 2023
217e8ad
Better logging for detected versions
WojciechMazur Jan 12, 2023
ac880e8
Add raports for every build
WojciechMazur Jan 12, 2023
9f59bb4
use personal config
WojciechMazur Jan 12, 2023
8757743
fix coordinator
WojciechMazur Jan 12, 2023
ec66f0a
Update build config
WojciechMazur Jan 12, 2023
b52af79
Merge pull request #3 from WojciechMazur/build/scheduled-update-16735…
WojciechMazur Jan 13, 2023
a4c5147
Allow to pass scalacOptions (#4)
WojciechMazur Jan 13, 2023
e708903
Update build config (#5)
WojciechMazur Jan 13, 2023
1edb1cc
Fix build failures
WojciechMazur Jan 13, 2023
258c1c6
Workaround secreats not being passed to actions
WojciechMazur Jan 13, 2023
88d22d2
Fix typos
WojciechMazur Jan 13, 2023
8835573
Try fix build issues
WojciechMazur Jan 13, 2023
b60d9d7
Fix passing secrets
WojciechMazur Jan 13, 2023
4e459e9
Fix passing secrets
WojciechMazur Jan 13, 2023
426953c
Fix resuable workflows
WojciechMazur Jan 13, 2023
931f1d6
Try fix issues with missing urls
WojciechMazur Jan 13, 2023
9e9ae6d
Fix unescaped $
WojciechMazur Jan 13, 2023
3c053e1
Update build config (#6)
WojciechMazur Jan 13, 2023
767a333
Ignore CI when updating non infra related changes
WojciechMazur Jan 13, 2023
75644cd
Set timeout of 1h for building single project
WojciechMazur Jan 13, 2023
1751d41
fix timeouts
WojciechMazur Jan 14, 2023
24f087c
Don't upload artifacts
WojciechMazur Jan 14, 2023
e908bf5
Use Dotty base image for compiler image
WojciechMazur Jan 14, 2023
2c976b3
Fix getting jobs urls
WojciechMazur Jan 14, 2023
1bdb1af
Make sure any subsequent job depends on setup-build so it can read it…
WojciechMazur Jan 14, 2023
32a13d3
cache coordinator outputs weekly
WojciechMazur Jan 14, 2023
5479e05
Update build config
WojciechMazur Jan 14, 2023
a752be5
Expose filtering out scalacOption
WojciechMazur Jan 14, 2023
0b36b37
Redirect build stdout to file to speed-up builds. Print logs only on …
WojciechMazur Jan 14, 2023
80d520a
Fix resolving job url
WojciechMazur Jan 14, 2023
f3047ff
Update build config
WojciechMazur Jan 14, 2023
f425508
Trigger build update on push to coordinator or env directories
WojciechMazur Jan 14, 2023
6f98bd3
Set run name
WojciechMazur Jan 14, 2023
1dc55db
fix typo
WojciechMazur Jan 14, 2023
dc0e5c8
try fix resolving urls
WojciechMazur Jan 14, 2023
c1f0141
set gh_token
WojciechMazur Jan 14, 2023
ff94540
guard against empty values
WojciechMazur Jan 14, 2023
ae1a8c6
try fix builds errors
WojciechMazur Jan 14, 2023
10a43a9
try fix errors
WojciechMazur Jan 15, 2023
44f46a8
try fix
WojciechMazur Jan 15, 2023
2cc1536
try fix
WojciechMazur Jan 15, 2023
9df5106
try fix 502
WojciechMazur Jan 15, 2023
4bd0ea4
normalize gh output
WojciechMazur Jan 15, 2023
70f12f5
fix stderr redirect
WojciechMazur Jan 15, 2023
fd9f4f3
don't show indexed json
WojciechMazur Jan 15, 2023
94fcd7c
Fill gaps when limiting max numer of projects
WojciechMazur Jan 15, 2023
6e45765
Limit to max 1k projects, revert stage size to 255 (was 100)
WojciechMazur Jan 15, 2023
eca7ef8
Revert redirecting stdout to file
WojciechMazur Jan 15, 2023
8f4f7b2
Disable by defalt deprectation and warnings in sbt
WojciechMazur Jan 15, 2023
1e20d4e
retry to resole build url
WojciechMazur Jan 15, 2023
46d091f
clenaup
WojciechMazur Jan 15, 2023
07079e9
don't resolve build url if skipping
WojciechMazur Jan 15, 2023
8635fe4
fix typo
WojciechMazur Jan 15, 2023
79be3cb
fix typo leading to missing build url
WojciechMazur Jan 16, 2023
d9bbc19
Remove unused default sbt setting
WojciechMazur Jan 16, 2023
19dc921
Fix failures when trying to parse empty url
WojciechMazur Jan 16, 2023
c3d9fb9
update config
WojciechMazur Jan 16, 2023
966a5e6
fix bash scripts
WojciechMazur Jan 16, 2023
5c7b13b
Allow to compare against exact build
WojciechMazur Jan 16, 2023
633e0ec
use predefined memory options for sbt
WojciechMazur Jan 16, 2023
0b9a50b
Cleanup sbt plugin
WojciechMazur Jan 16, 2023
5884228
Update build config
WojciechMazur Jan 16, 2023
b575b62
Fix typo in sbt build.sh
WojciechMazur Jan 20, 2023
07d70c4
Allow to specify custom build name
WojciechMazur Jan 20, 2023
5f39c08
warmup more sbt versions
WojciechMazur Jan 20, 2023
28fdf7d
Clenaup in sbt/build.sh
WojciechMazur Jan 20, 2023
c42251e
Merge branch 'master' of https://github.com/WojciechMazur/community-b…
WojciechMazur Jan 20, 2023
2b8282c
cleanup
WojciechMazur Jan 20, 2023
96d64d8
rename build-name description
WojciechMazur Jan 20, 2023
5da7f42
Don't set GC in sbt builds
WojciechMazur Jan 20, 2023
bdb4f70
Fix erasure of default scalacOptions
WojciechMazur Jan 23, 2023
ad2e96f
Cleanup build reports
WojciechMazur Jan 23, 2023
873d1ec
Disable auto approve/merge when updaing build plan
WojciechMazur Jan 23, 2023
9d49474
Updates after changes to infra
WojciechMazur Jan 23, 2023
20215ba
Run scheduled builds only on the main repo
WojciechMazur Jan 30, 2023
43154f8
Improved job name descriptions
WojciechMazur Jan 30, 2023
6447e72
fix custom build names
WojciechMazur Jan 30, 2023
a098db4
fix typo
WojciechMazur Jan 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions .github/actions/build-project/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: "Build projects"
description: "Used to build a project withing the Open cOmunityu Build"
inputs:
project-name:
description: "Name of the project to build"
required: true
scala-version:
description: "Scala Version to use"
required: true
extra-scalac-options:
description: "List of scalacOptions which should be used when building projects. Multiple entires should be seperated by a single comma character `,`"
default: ""
disabled-scalac-options:
description: "List of scalacOptions which should be filted out when building projects."
default: ""
# Infrastructure inputs / secrets
maven-repo-url:
description: "Custom Maven repository used to store artifacts"
required: true
elastic-user:
description: "Secret with auth user to elasticsearch"
required: true
elastic-password:
description: "Secret with auth token to elasticsearch"
required: true
runs:
using: "composite"
steps:
- uses: coursier/setup-action@v1
with:
apps: cs

- name: Check java version
shell: bash
run: |
ConfigFile=".github/workflows/buildConfig.json"
DefaultJDK=11
javaVersion=$(jq -r ".\"${{ inputs.project-name }}\".config.java.version // ${DefaultJDK}" $ConfigFile)
echo "java-version=$javaVersion" >> $GITHUB_ENV
echo "JavaVersion set to $javaVersion"


- name: Check can skip build
id: check-history
shell: bash
run: |
ConfigFile=".github/workflows/buildConfig.json"
ScalaVersion="${{ inputs.scala-version }}"
BinScalaVersion=3
CustomMavenRepo="${{ inputs.maven-repo-url }}"

projectVersion="$(jq -r ".\"${{ inputs.project-name }}\".version" $ConfigFile)"

canSkip=true
if [[ -n "${{ inputs.extra-scalac-options }}" || -n "${{ inputs.disabled-scalac-options }}" ]]; then
echo "Using custom scalacOption, cannot skip"
canSkip=false
else
for target in $(jq -r ".\"${{ inputs.project-name }}\".targets" $ConfigFile); do
arr=($(echo $target | tr "%" " "))
#use offset:length for consistent indexing (zsh starts with 1, bash starts with 0)
org=${arr[@]:0:1}
name=${arr[@]:1:1}
artifact="${org}:${name}_${BinScalaVersion}:${projectVersion}"

if ! cs resolve --intransitive "$artifact" -r "$CustomMavenRepo" --no-default >> /dev/null ; then
echo "Artifact $artifact not found, would build the project"
canSkip=false
break;
fi
done
fi
echo "Can skip build: $canSkip"
echo "can-skip-build=${canSkip}" >> $GITHUB_OUTPUT

- name: Get current job URL
id: job-info
if: steps.check-history.outputs.can-skip-build != 'true'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
GITHUB_API="repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs"
JOB_NAME="execute-build-plan / ${{ github.job }} (${{ inputs.project-name }})"
PARAMS="?per_page=100"
SELECT_URL=".jobs | map(select(.name == \"${JOB_NAME}\")) | .[0].html_url"

set -o pipefail

outFile="gh.out"
buildURL=""
for i in $(seq 1 10) ;do
if gh api "${GITHUB_API}${PARAMS}" --paginate --jq "${SELECT_URL}" 2>&1 | tee $outFile; then
buildURL="$(cat $outFile | xargs)"
break
elif grep -q 'API rate limit exceeded' "$outFile"; then
echo "GitHub API rate limit exceeded, skip resolving build URL"
break
elif grep -q 'Server Error (HTTP 502)' "$outFile"; then
echo "Server error when resolving build URL, retry with backoff"
sleep 5
else
echo "Unknown error when resolving build URL:"
cat $outFile
break
fi
done

echo "Build URL: $buildURL"
echo "build-url=${buildURL}" >> $GITHUB_OUTPUT

- name: Build project
uses: addnab/docker-run-action@v3
if: steps.check-history.outputs.can-skip-build != 'true'
with:
image: "virtuslab/scala-community-build-project-builder:jdk${{ env.java-version }}-v0.2.1"
options: -v ${{ github.workspace }}:/opencb/ -e ELASTIC_USERNAME=${{ inputs.elastic-user }} -e ELASTIC_PASSWORD=${{ inputs.elastic-password }}
run: |
ConfigFile="/opencb/.github/workflows/buildConfig.json"
DefaultConfig='{"memoryRequestMb":4096}'
config () {
path=".\"${{ inputs.project-name }}\"$@"
jq -c -r "$path" $ConfigFile
}

touch build-logs.txt build-summary.txt
# Assume failure unless overwritten by a successful build
echo 'failure' > build-status.txt

/build/build-revision.sh \
"$(config .repoUrl)" \
"$(config .revision)" \
"${{ inputs.scala-version }}" \
"$(config .version)" \
"$(config .targets)" \
"${{ inputs.maven-repo-url }}" \
'1.6.2' \
"$(config .config // ${DefaultConfig})" \
"${{ inputs.extra-scalac-options }}" \
"${{ inputs.disabled-scalac-options }}" 2>&1 | tee build-logs.txt

# Remove ASCII coloring from the indexed logs
cat build-logs.txt | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g" > build-logs-uncolored.txt

/build/feed-elastic.sh \
'https://scala3.westeurope.cloudapp.azure.com/data' \
"${{ inputs.project-name }}" \
"$(cat build-status.txt)" \
"$(date --iso-8601=seconds)" \
build-summary.txt \
build-logs-uncolored.txt \
"$(config .version)" \
"${{ inputs.scala-version }}" \
"${{ github.run_id }}" \
"${{ steps.job-info.outputs.build-url }}"
if [ $? != 0 ]; then
echo "::warning title=Indexing failure::Indexing results of ${{ inputs.project-name }} failed"
fi

# Store results
mv build-logs.txt /opencb/
mv build-status.txt /opencb/
mv build-summary.txt /opencb

# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# if: steps.check-history.outputs.can-skip-build != 'true'
# with:
# name: ${{ inputs.project-name }}
# path: ${{ github.workspace }}/build-*.txt

- name: Check results
shell: bash
if: steps.check-history.outputs.can-skip-build != 'true'
run: |
# Set the result of the build
if [[ "$(cat build-status.txt)" == "success" ]]; then
echo "Build successful"
else
echo "Build failure! Check logs for details"
exit 1
fi
81 changes: 81 additions & 0 deletions .github/actions/setup-build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: "Prepare Open Community Build"
description: "Ensure compiler version is published, resolve url for custom Maven repository"
inputs:
scala-version:
description: "Scala version to check"
repository-url:
description: "GitHub repository URL for compiler to build"
required: true
repository-branch:
description: "GitHub repository branch for compiler to build"
required: true
outputs:
scala-version:
description: "Effective Scala version, input value of scala-version if using published version or version of builded compiler"
value: ${{ steps.calc-version.outputs.effective-scala-version }}
maven-repo-url:
description: "Effective Maven repository subdirectory to use"
value: ${{ steps.calc-version.outputs.effective-maven-url }}

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
with:
repository: ${{ inputs.repository-url }}
ref: ${{ inputs.repository-branch }}
path: "compiler"

- name: Calculate version if missing
id: calc-version
shell: bash
run: |
commitHash=$(git rev-parse HEAD)

scalaVersion=${{ inputs.scala-version }}
if [[ -z $scalaVersion ]]; then
baseVersion=$(cat compiler/project/Build.scala | grep 'val baseVersion =' | xargs | awk '{ print $4 }')
scalaVersion="${baseVersion}-bin-${commitHash}"
fi

baseMavenRepo="https://scala3.westeurope.cloudapp.azure.com/maven2"
buildMavenRepo="${baseMavenRepo}/${scalaVersion}"

echo "Effective Scala version for this build: $scalaVersion"
echo "effective-scala-version=${scalaVersion}" >> $GITHUB_OUTPUT

echo "Effective Maven repository for this build: $buildMavenRepo"
echo "effective-maven-url=${buildMavenRepo}" >> $GITHUB_OUTPUT

- name: Install coursier
uses: coursier/setup-action@v1
with:
apps: cs
- name: Check version is published
shell: bash
id: check-published
run: |
Version="${{ steps.calc-version.outputs.effective-scala-version }}"
CustomMavenRepo="${{ steps.calc-version.outputs.effective-maven-url }}"
isPublished=false
# Download jar instead of checking only for pom to ensure that it's complete
if cs fetch org.scala-lang:scala3-compiler_3:${Version} -r $CustomMavenRepo ; then
isPublished=true
elif [[ ! -z "${{ inputs.scala-version }}" ]]; then
echo "::error title=Compiler version unavailable::Requested compiler version ${{ inputs.scala-version }} is unavailable"
exit 1
fi
echo "Can skip compiler build: ${isPublished}"
echo "is-compiler-published=${isPublished}" >> $GITHUB_OUTPUT

- name: Build compiler
uses: addnab/docker-run-action@v3
if: steps.check-published.outputs.is-compiler-published == 'false'
with:
image: "virtuslab/scala-community-build-compiler-builder:v0.2.1"
options: -v ${{ github.workspace }}/compiler:/compiler/
run: |
Version="${{ steps.calc-version.outputs.effective-scala-version }}"
CustomMavenRepo="${{ steps.calc-version.outputs.effective-maven-url }}"
echo "Building Scala compiler, version ${Version}"
/build/build.sh /compiler "${Version}" "${CustomMavenRepo}"
58 changes: 58 additions & 0 deletions .github/workflows/buildAutoUpdatePlan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Auto update build plan

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
schedule:
# Every friday at 4 PM
- cron: "0 16 * * 5"
push:
paths:
- coordinator/**
- env/**
jobs:
build-plan:
runs-on: ubuntu-22.04
if: github.event_name == 'schedule' && github.repository == 'VirtusLab/community-build3'
steps:
- name: Git Checkout
uses: actions/checkout@v3

- name: Install coursier
uses: coursier/setup-action@v1
with:
apps: scala-cli

- name: Get Date
id: get-date
run: echo "week-start=$(date -dmonday +%Y%m%d)" >> $GITHUB_OUTPUT

- name: Cache coordinator data
uses: actions/cache@v3
with:
# coordinator stores cache in current working directory
path: data/
key: coordinator-data-cache-${{ steps.get-date.outputs.week-start}}

- name: Build plan
# Limit to 1000 most starred project. GitHub actions has problems when rendering workflow of more then 1k jobs
run: scala-cli run coordinator/ -- 3 -1 1000 "" env/prod/config/replaced-projects.txt env/prod/config/projects-config.conf env/prod/config/filtered-projects.txt

- name: Create PR
uses: peter-evans/create-pull-request@v4
id: cpr
with:
token: ${{ secrets.OPENCB_CONFIG_UPDATE_TOKEN }}
commit-message: Update build config
assignees: WojciechMazur
branch: build/scheduled-update
branch-suffix: timestamp
delete-branch: true
title: "[Bot] Update build config"
draft: false
add-paths: |
.github/workflows/buildPlan.yaml
.github/workflows/buildConfig.json
Loading