117 lines
3.3 KiB
YAML
117 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/*
|
|
|
|
jobs:
|
|
build_and_test:
|
|
name: Build and Test
|
|
|
|
runs-on: macos-12
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: ./.github/actions/clone-everything
|
|
with:
|
|
access-token: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Setup environment
|
|
shell: bash
|
|
run: |
|
|
REQUIRED_VERSION=13.2
|
|
CURRENT_VERSION=$(xcodebuild -version | grep "Xcode" | awk '{print $2}')
|
|
|
|
echo "Current Xcode version: $CURRENT_VERSION"
|
|
echo "Required Xcode version: $REQUIRED_VERSION"
|
|
|
|
if [[ $CURRENT_VERSION != $REQUIRED_VERSION ]]; then
|
|
# Path format pulled from https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode
|
|
NEW_XCODE="/Applications/Xcode_$REQUIRED_VERSION.app"
|
|
echo "Changing selected Xcode to $NEW_XCODE"
|
|
sudo xcode-select -s $NEW_XCODE
|
|
|
|
CURRENT_VERSION=$(xcodebuild -version | grep "Xcode" | awk '{print $2}')
|
|
echo "$?: Current Xcode version: $CURRENT_VERSION"
|
|
fi
|
|
|
|
- name: Setup Ruby
|
|
uses: ruby/setup-ruby@v1 # Reads .ruby-version file by default
|
|
|
|
- name: Cache Bundle Install
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: vendor/bundle
|
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gems-
|
|
|
|
- name: Bundle Install
|
|
run: |
|
|
bundle config path vendor/bundle
|
|
bundle install --jobs 4 --retry 3
|
|
|
|
- name: Build and Test
|
|
run: |
|
|
function formatFailures() {
|
|
grep '<failure message' fastlane/test_output/report.junit | sed -E "s/^.*<failure message='(.*)'>(.*):([0-9]+)<\/failure>/::error file=\2,line=\3::\1/" | sed -E 's/"/"/g'
|
|
exit 1
|
|
}
|
|
|
|
bundle exec fastlane scan --scheme Signal --output_types junit || formatFailures
|
|
|
|
- name: Upload build logs
|
|
uses: actions/upload-artifact@v3
|
|
if: failure()
|
|
with:
|
|
name: Logs
|
|
path: ~/Library/Logs/scan
|
|
|
|
check_autogenstrings:
|
|
name: Check if strings file is outdated
|
|
|
|
runs-on: macos-12
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: ./.github/actions/clone-everything
|
|
with:
|
|
access-token: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Run genstrings
|
|
run: Scripts/translation/auto-genstrings
|
|
|
|
- name: Check for any changes
|
|
run: git diff --exit-code
|
|
|
|
lint:
|
|
name: Lint
|
|
|
|
runs-on: macos-11
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Fetch base commit
|
|
run: git fetch origin --depth 1 ${{ github.base_ref }}
|
|
|
|
- name: Install Dependencies
|
|
run: brew install clang-format python3
|
|
|
|
- name: Lint files changed in the PR
|
|
run: |
|
|
python3 Scripts/precommit.py --ref origin/${{ github.base_ref }}
|
|
|
|
# https://help.github.com/en/actions/reference/development-tools-for-github-actions#logging-commands
|
|
git diff --name-only | sed -E 's|(.*)|::error file=\1::Incorrectly formatted (Scripts/precommit.py)|'
|
|
git diff --exit-code || exit 1
|