Skip to content

Throw custom exception to understand better context of crash #5271

Throw custom exception to understand better context of crash

Throw custom exception to understand better context of crash #5271

Workflow file for this run

# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Publish on release commits
# This workflow detects commits where the message starts with "Release version X.Y.Z".
# It runs tests in parallel before publishing and uploading it.
# When the upload is complete the revision is tagged as a release
# and a script checks whether the artifacts are available.
#
# If the workflow fails any commit with the same version message marker
# will trigger the workflow again.
on:
push:
branches:
- master
jobs:
check-release-job:
name: Check for release marker
runs-on: ubuntu-latest
outputs:
is-release: ${{ steps.check_version.outcome == 'success' }}
release-version-info: ${{ steps.version_info.outputs.VERSION_INFO }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract version info
id: version_info
run: echo "VERSION_INFO=`git log --format=%B -n 1 . | egrep '^[rR]elease version' | egrep -o '([[:digit:]]+\.){2}[[:digit:]]+' | xargs -0 printf v%s`" >> $GITHUB_OUTPUT
- name: Check version
id: check_version
if: ${{ steps.version_info.outputs.VERSION_INFO != 'v' }}
env:
VERSION_INFO: ${{ steps.version_info.outputs.VERSION_INFO }}
run: echo $VERSION_INFO
start-release-job:
name: Skip all if not a release
needs: [check-release-job]
if: ${{ needs.check-release-job.outputs.is-release == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check step
run: echo "Starting a release"
test-job:
name: Run Tests
needs: [start-release-job]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Run tests
uses: nick-invision/retry@v1
with:
timeout_minutes: 60
max_attempts: 2
command: BUCK_PATH=`realpath buck/buck` ./gradlew test -x :litho-intellij-plugin:test -x :litho-core:test -x :litho-it:test --stacktrace
sample-app-job:
name: Assemble Sample App
needs: [start-release-job]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Assemble sample app
run: BUCK_PATH=`realpath buck/buck` ./gradlew :sample:assembleRelease --stacktrace
publish-job:
name: Maven Publish
runs-on: ubuntu-latest
needs: [test-job, sample-app-job]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Write GPG Sec Ring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties
run: echo -e "signing.secretKeyRingFile=/tmp/secring.gpg\nsigning.keyId=${{ secrets.SIGNING_KEY_ID }}\nsigning.password=${{ secrets.SIGNING_PASSWORD }}\nmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}\nmavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }}" >> gradle.properties
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Upload Android Archives
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache -PforceReleaseBuild=true
- name: Clean secrets
if: always()
run: rm /tmp/secring.gpg
push-tags-job:
name: Push tags if release succeeded
runs-on: ubuntu-latest
needs: [check-release-job, publish-job]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set Git tag
uses: tvdias/github-tagger@v0.0.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: ${{ needs.check-release-job.outputs.release-version-info }}