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

[RunAllTests] Fix part of #2844: work around Bazel-specific CI issue that's causing an OpenJDK crash/flake #2846

Merged
merged 5 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
55 changes: 40 additions & 15 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,44 @@ jobs:
os: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Clone Oppia Bazel
run: git clone https://github.com/oppia/bazel.git $HOME/oppia-bazel

- name: Set up JDK 9
uses: actions/setup-java@v1
with:
java-version: 9
- name: Extract Android tools

- name: Check Java version & path
run: |
which java
java -version
echo "Java home: $JAVA_HOME"
$JAVA_HOME/bin/java -version

- name: Set up Bazel
uses: abhinavsingh/setup-bazel@v3
with:
version: 4.0.0

- name: Configure Bazel to use JDK 9 for building
run: |
echo "build --java_language_version=9" >> $HOME/.bazelrc
BenHenning marked this conversation as resolved.
Show resolved Hide resolved

- name: Configure Bazel to use specific sandbox tmpfs
run: |
echo "build --enable_platform_specific_config" >> $HOME/.bazelrc
echo "build:linux --sandbox_tmpfs_path=/tmp" >> $HOME/.bazelrc

- name: Check Bazel environment
run: bazel info

- name: Set up Oppia Bazel Android Tools
run: |
mkdir -p $GITHUB_WORKSPACE/tmp/android_tools
cd $HOME/oppia-bazel
unzip bazel-tools.zip
tar -xf $HOME/oppia-bazel/android_tools.tar.gz -C $GITHUB_WORKSPACE/tmp/android_tools
mkdir $HOME/opensource
cd $HOME/opensource
git clone https://github.com/oppia/oppia-bazel-tools
echo build --override_repository=android_tools="$(cd "$(dirname "$HOME/opensource/oppia-bazel-tools")"; pwd)/$(basename "$HOME/opensource/oppia-bazel-tools")" >> $HOME/.bazelrc
echo build --android_databinding_use_androidx >> $HOME/.bazelrc

# See https://git-secret.io/installation for details on installing git-secret. Note that the
# apt-get method isn't used since it's much slower to update & upgrade apt before installation
# versus just directly cloning & installing the project. Further, the specific version
Expand All @@ -48,6 +74,7 @@ jobs:
PREFIX="$HOME/gitsecret" make install
echo "$HOME/gitsecret" >> $GITHUB_PATH
echo "$HOME/gitsecret/bin" >> $GITHUB_PATH

- name: Decrypt secrets (non-fork only)
if: ${{ github.event.pull_request.head.repo.full_name == 'oppia/oppia-android' }}
env:
Expand All @@ -59,25 +86,23 @@ jobs:
gpg --import ./git_secret_private_key.gpg
cd $GITHUB_WORKSPACE
git secret reveal
- name: Unzip Bazel binary
run: |
cd $HOME/oppia-bazel
unzip bazel-build.zip
cd $GITHUB_WORKSPACE
chmod a+x $HOME/oppia-bazel/bazel

# Note that caching only works on non-forks.
- name: Build Oppia binary (with caching, non-fork only)
if: ${{ github.event.pull_request.head.repo.full_name == 'oppia/oppia-android' }}
env:
BAZEL_REMOTE_CACHE_URL: ${{ secrets.BAZEL_REMOTE_CACHE_URL }}
run: |
$HOME/oppia-bazel/bazel build --override_repository=android_tools=$GITHUB_WORKSPACE/tmp/android_tools --remote_http_cache=$BAZEL_REMOTE_CACHE_URL --google_credentials=./config/oppia-dev-workflow-remote-cache-credentials.json -- //:oppia
bazel build --remote_http_cache=$BAZEL_REMOTE_CACHE_URL --google_credentials=./config/oppia-dev-workflow-remote-cache-credentials.json -- //:oppia

- name: Build Oppia binary (without caching, fork only)
if: ${{ github.event.pull_request.head.repo.full_name != 'oppia/oppia-android' }}
run: |
$HOME/oppia-bazel/bazel build --override_repository=android_tools=$GITHUB_WORKSPACE/tmp/android_tools -- //:oppia
bazel build -- //:oppia

- name: Copy Oppia APK for uploading
run: cp $GITHUB_WORKSPACE/bazel-bin/oppia.apk /home/runner/work/oppia-android/oppia-android/

- uses: actions/upload-artifact@v2
with:
name: oppia-bazel-apk
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,44 @@ jobs:
matrix: ${{fromJson(needs.bazel_compute_affected_targets.outputs.matrix)}}
steps:
- uses: actions/checkout@v2

- name: Set up JDK 9
uses: actions/setup-java@v1
with:
java-version: 9

- name: Check Java version & path
run: |
which java
java -version
echo "Java home: $JAVA_HOME"
$JAVA_HOME/bin/java -version

- name: Set up Bazel
uses: abhinavsingh/setup-bazel@v3
with:
version: 4.0.0

- name: Configure Bazel to use JDK 9 for building
run: |
echo "build --java_language_version=9" >> $HOME/.bazelrc

- name: Configure Bazel to use specific sandbox tmpfs
run: |
echo "build --enable_platform_specific_config" >> $HOME/.bazelrc
echo "build:linux --sandbox_tmpfs_path=/tmp" >> $HOME/.bazelrc

- name: Check Bazel environment
run: bazel info

- name: Set up Oppia Bazel Android Tools
run: |
mkdir $HOME/opensource
cd $HOME/opensource
git clone https://github.com/oppia/oppia-bazel-tools
echo build --override_repository=android_tools="$(cd "$(dirname "$HOME/opensource/oppia-bazel-tools")"; pwd)/$(basename "$HOME/opensource/oppia-bazel-tools")" >> $HOME/.bazelrc
echo build --android_databinding_use_androidx >> $HOME/.bazelrc

# See explanation in bazel_build_app for how this is installed.
- name: Install git-secret (non-fork only)
if: ${{ (github.ref == 'refs/heads/develop' && github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == 'oppia/oppia-android') }}
Expand All @@ -89,6 +112,7 @@ jobs:
PREFIX="$HOME/gitsecret" make install
echo "$HOME/gitsecret" >> $GITHUB_PATH
echo "$HOME/gitsecret/bin" >> $GITHUB_PATH

- name: Decrypt secrets (non-fork only)
if: ${{ (github.ref == 'refs/heads/develop' && github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == 'oppia/oppia-android') }}
env:
Expand All @@ -100,11 +124,13 @@ jobs:
gpg --import ./git_secret_private_key.gpg
cd $GITHUB_WORKSPACE
git secret reveal

- name: Run Oppia Test (with caching, non-fork only)
if: ${{ (github.ref == 'refs/heads/develop' && github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == 'oppia/oppia-android') }}
env:
BAZEL_REMOTE_CACHE_URL: ${{ secrets.BAZEL_REMOTE_CACHE_URL }}
run: bazel test --remote_http_cache=$BAZEL_REMOTE_CACHE_URL --google_credentials=./config/oppia-dev-workflow-remote-cache-credentials.json -- ${{ matrix.test-target }}

- name: Run Oppia Test (without caching, fork only)
if: ${{ (github.ref != 'refs/heads/develop' || github.event_name != 'push') && (github.event.pull_request.head.repo.full_name != 'oppia/oppia-android') }}
env:
Expand Down