-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from streem/garyp/github-runner-update
Update GitHub runner versions and project status
- Loading branch information
Showing
4 changed files
with
324 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,300 @@ | ||
name: Build and Test | ||
|
||
env: | ||
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process' | ||
JAVA_VERSION: 11 | ||
NODEJS_VERSION: 14 | ||
PROTOBUF_CONFORMANCE_VERSION: 3.10.1 | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-22.04 | ||
os-type: linux | ||
- os: macos-12 | ||
os-type: macos | ||
fail-fast: false | ||
name: Build (${{ matrix.os-type }}) | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Cache gradle | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
~/.konan | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Install Java ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
# TODO: remove this after updating to the latest version of Kotlin | ||
- name: Install dependencies needed by native build | ||
if: matrix.os-type == 'linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libtinfo5 | ||
- name: Build project and run tests | ||
run: | | ||
if [ "${{ matrix.os-type }}" == "linux" ]; then | ||
./gradlew build --stacktrace | ||
else | ||
./gradlew compileKotlinIosArm64 \ | ||
compileKotlinIosSimulatorArm64 \ | ||
compileKotlinIosX64 \ | ||
compileKotlinTvosArm64 \ | ||
compileKotlinTvosSimulatorArm64 \ | ||
compileKotlinTvosX64 \ | ||
compileKotlinMacosArm64 \ | ||
compileKotlinMacosX64 \ | ||
compileTestKotlinIosArm64 \ | ||
compileTestKotlinIosSimulatorArm64 \ | ||
compileTestKotlinIosX64 \ | ||
compileTestKotlinTvosArm64 \ | ||
compileTestKotlinTvosSimulatorArm64 \ | ||
compileTestKotlinTvosX64 \ | ||
compileTestKotlinMacosArm64 \ | ||
compileTestKotlinMacosX64 \ | ||
iosX64Test \ | ||
tvosX64Test \ | ||
macosX64Test \ | ||
--stacktrace | ||
fi | ||
- name: Ensure bundled types are up-to-date | ||
if: matrix.os-type == 'linux' | ||
run: | | ||
./gradlew generateProtos | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "::error::Found uncommitted changes to bundled types" | ||
git status | ||
exit 1 | ||
else | ||
exit 0 | ||
fi | ||
- name: Publish artifacts to local maven repository | ||
run: | | ||
if [ "${{ matrix.os-type }}" == "linux" ]; then | ||
./gradlew publishToMavenLocal | ||
else | ||
./gradlew publishIosArm64PublicationToMavenLocal \ | ||
publishIosSimulatorArm64PublicationToMavenLocal \ | ||
publishIosX64PublicationToMavenLocal \ | ||
publishTvosArm64PublicationToMavenLocal \ | ||
publishTvosSimulatorArm64PublicationToMavenLocal \ | ||
publishTvosX64PublicationToMavenLocal \ | ||
publishMacosArm64PublicationToMavenLocal \ | ||
publishMacosX64PublicationToMavenLocal | ||
fi | ||
echo "Published files:" | ||
find $HOME/.m2/repository -type f | ||
- name: Upload maven artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: maven-artifacts-${{ matrix.os-type }} | ||
path: ~/.m2/repository | ||
|
||
- name: Build conformance test suite | ||
run: | | ||
if [ "${{ matrix.os-type }}" == "linux" ]; then | ||
./gradlew \ | ||
:conformance:conformance-lib:assemble \ | ||
:conformance:conformance-jvm:installDist \ | ||
:conformance:conformance-native:build | ||
else | ||
./gradlew :conformance:conformance-native:build | ||
fi | ||
- name: Package files necessary to run conformance tests | ||
run: | | ||
if [ "${{ matrix.os-type }}" == "linux" ]; then | ||
tar -cvf conformance-test-files-${{ matrix.os-type }}.tar \ | ||
conformance/test-conformance.sh \ | ||
conformance/jvm/build/install/conformance \ | ||
conformance/jvm/failing_tests.txt \ | ||
build/js \ | ||
conformance/js/failing_tests.txt \ | ||
conformance/js/run.sh \ | ||
conformance/native/build/bin/linux/conformanceReleaseExecutable/conformance.kexe \ | ||
conformance/native/failing_tests.txt | ||
else | ||
tar -cvf conformance-test-files-${{ matrix.os-type }}.tar \ | ||
conformance/test-conformance.sh \ | ||
conformance/native/build/bin/macos/conformanceReleaseExecutable/conformance.kexe \ | ||
conformance/native/failing_tests.txt | ||
fi | ||
- name: Upload files necessary to run conformance tests | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: conformance-test-files-${{ matrix.os-type }} | ||
path: conformance-test-files-${{ matrix.os-type }}.tar | ||
|
||
- name: Bundle the build report | ||
if: failure() | ||
run: find . -type d -name 'reports' | zip -@ -r build-reports-${{ matrix.os-type }}.zip | ||
|
||
- name: Upload the build report | ||
if: failure() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: error-report-${{ matrix.os-type }} | ||
path: build-reports-${{ matrix.os-type }}.zip | ||
|
||
build-conformance-test-runner: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-22.04 | ||
os-type: linux | ||
- os: macos-12 | ||
os-type: macos | ||
fail-fast: false | ||
name: Build conformance test runner (${{ matrix.os-type }}) | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Cache protobuf conformance-test-runner ${{ env.PROTOBUF_CONFORMANCE_VERSION }} | ||
uses: actions/cache@v2 | ||
id: cache-protobuf | ||
with: | ||
path: ~/protobuf | ||
key: ${{ runner.os }}-protobuf-${{ env.PROTOBUF_CONFORMANCE_VERSION }} | ||
|
||
- name: Build protobuf conformance-test-runner | ||
if: steps.cache-protobuf.outputs.cache-hit != 'true' | ||
run: | | ||
cd ~ | ||
curl -sSLO https://github.com/protocolbuffers/protobuf/releases/download/v${{ env.PROTOBUF_CONFORMANCE_VERSION }}/protobuf-all-${{ env.PROTOBUF_CONFORMANCE_VERSION }}.tar.gz | ||
tar xzvf protobuf-all-${{ env.PROTOBUF_CONFORMANCE_VERSION }}.tar.gz | ||
mv protobuf-${{ env.PROTOBUF_CONFORMANCE_VERSION }} protobuf | ||
cd protobuf | ||
./configure | ||
make | ||
cd conformance | ||
make | ||
conformance: | ||
needs: [ build, build-conformance-test-runner ] | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-22.04 | ||
os-type: linux | ||
platform: jvm | ||
- os: ubuntu-22.04 | ||
os-type: linux | ||
platform: js | ||
- os: ubuntu-22.04 | ||
os-type: linux | ||
platform: linux | ||
- os: macos-12 | ||
os-type: macos | ||
platform: macos | ||
fail-fast: false | ||
name: Conformance tests (${{ matrix.platform }}) | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Install Java ${{ env.JAVA_VERSION }} | ||
if: matrix.platform == 'jvm' | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Install Node.js ${{ env.NODEJS_VERSION }} | ||
if: matrix.platform == 'js' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ env.NODEJS_VERSION }} | ||
|
||
# TODO: remove this after updating to the latest version of Kotlin | ||
- name: Install dependencies needed by native build | ||
if: matrix.platform == 'linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libtinfo5 | ||
- name: Cache protobuf conformance-test-runner ${{ env.PROTOBUF_CONFORMANCE_VERSION }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/protobuf | ||
key: ${{ runner.os }}-protobuf-${{ env.PROTOBUF_CONFORMANCE_VERSION }} | ||
|
||
- name: Download conformance test files | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: conformance-test-files-${{ matrix.os-type }} | ||
|
||
- name: Extract conformance test files | ||
run: tar -xvf conformance-test-files-${{ matrix.os-type }}.tar | ||
|
||
- name: Run ${{ matrix.platform }} conformance tests | ||
run: | | ||
export CONF_TEST_PATH=~/protobuf/conformance/conformance-test-runner | ||
./conformance/test-conformance.sh ${{ matrix.platform }} | ||
build-examples: | ||
needs: build | ||
name: Build examples | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Download maven artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: maven-artifacts-linux | ||
path: ~/.m2/repository | ||
|
||
- name: Cache gradle | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-examples-${{ hashFiles('examples/**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle-examples- | ||
- name: Install Java ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Build all examples | ||
run: | | ||
for d in examples/*; do | ||
set -e | ||
[ -d "$d" ] || continue | ||
echo "::group::Build $d" | ||
pushd "$d" >/dev/null | ||
../../gradlew build | ||
popd >/dev/null | ||
echo "::endgroup::" | ||
done |
Oops, something went wrong.