111 lines
3.0 KiB
YAML
111 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/*
|
|
|
|
# On PRs, "head_ref" is defined and is consistent across updates. On
|
|
# pushes, it's not defined, so we use "run_id", which is unique across
|
|
# every run; as a result, all actions on pushes will run to completion.
|
|
#
|
|
# Reference: https://docs.github.com/en/actions/using-jobs/using-concurrency
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# Path format pulled from https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode
|
|
DEVELOPER_DIR: /Applications/Xcode_14.2.app
|
|
|
|
jobs:
|
|
build_and_test:
|
|
name: Build and Test
|
|
|
|
timeout-minutes: 20
|
|
|
|
runs-on: macos-latest-xlarge
|
|
|
|
env:
|
|
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 7
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/clone-everything
|
|
with:
|
|
access-token: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Setup Ruby
|
|
uses: ruby/setup-ruby@v1 # Reads .ruby-version file by default
|
|
with:
|
|
bundler-cache: true
|
|
|
|
- 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 \
|
|
--skip_package_dependencies_resolution \
|
|
--disable_package_automatic_updates \
|
|
--xcargs '-test-timeouts-enabled YES -maximum-test-execution-time-allowance 60' \
|
|
|| 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
|
|
|
|
timeout-minutes: 10
|
|
|
|
runs-on: macos-12
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run genstrings
|
|
run: Scripts/translation/auto-genstrings
|
|
|
|
- name: Check for any changes
|
|
run: git diff --exit-code
|
|
|
|
lint:
|
|
name: Lint
|
|
|
|
timeout-minutes: 5
|
|
|
|
runs-on: macos-12
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- 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 }} --skip_license_header_checks
|
|
|
|
# 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
|