Skip to content

Commit

Permalink
Build: improve CI, add licence header checks, clean up example apps (#16
Browse files Browse the repository at this point in the history
)

* Improve CI, add license checks, remove old examples

* Update examples section in readme and docs

* Add newline to pre-commit hook, format build.yml

* Update license_header script to include created year
  • Loading branch information
vadymmarkov authored Feb 22, 2023
1 parent 5a50a90 commit b5a74ca
Show file tree
Hide file tree
Showing 47 changed files with 436 additions and 1,350 deletions.
10 changes: 10 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

./Scripts/license_headers.sh update

if which swiftlint >/dev/null; then
swiftlint --config .swiftlint-global.yml --quiet --strict
else
echo "error: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
exit 1
fi
109 changes: 109 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Build and test

on:
workflow_dispatch:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
check_license:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get changed files
id: files
uses: tj-actions/changed-files@v35

- name: Check license headers
run: |
./Scripts/license_headers.sh check "${{ steps.files.outputs.all_changed_files }}"
lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/realm/swiftlint:0.50.3

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Lint
run: |
swiftlint --config .swiftlint-global.yml --strict --reporter github-actions-logging
test-package:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
config:
- { destination: 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' }
- { destination: 'platform=macOS,arch=x86_64' }

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build and test
run: |
set -o pipefail && xcodebuild \
-scheme 'Pexip-Package' \
-destination '${{ matrix.config.destination }}' \
clean build test | xcpretty
build-conference-example:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
config:
- { scheme: 'Example (iOS)', destination: 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' }
- { scheme: 'Example (macOS)', destination: 'platform=macOS,arch=x86_64' }

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build
run: |
set -o pipefail && xcodebuild \
-project Examples/Conference/Example.xcodeproj \
-scheme '${{ matrix.config.scheme }}' \
-destination '${{ matrix.config.destination }}' \
clean build CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" CODE_SIGN_ENTITLEMENTS="" | xcpretty
build-video-filters-example:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup CocoaPods cache
uses: actions/cache@v2
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install CocoaPods
run: pod install --project-directory=Examples/VideoFilters

- name: Build
run: |
set -o pipefail && arch -x86_64 xcodebuild \
-workspace Examples/VideoFilters/VideoFiltersExample.xcworkspace \
-scheme 'VideoFiltersExample' \
-destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' \
clean build CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" | xcpretty
29 changes: 14 additions & 15 deletions .github/workflows/cocoapods.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Deploy to CocoaPods trunk

on:
workflow_dispatch:
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod trunk push PexipCore.podspec
pod trunk push PexipScreenCapture.podspec
pod trunk push PexipVideoFilters.podspec
pod trunk push PexipInfinityClient.podspec
pod trunk push PexipMedia.podspec
pod trunk push PexipRTC.podspec
- name: Checkout
uses: actions/checkout@v3
- name: Deploy to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod trunk push PexipCore.podspec
pod trunk push PexipScreenCapture.podspec
pod trunk push PexipVideoFilters.podspec
pod trunk push PexipInfinityClient.podspec
pod trunk push PexipMedia.podspec
pod trunk push PexipRTC.podspec
42 changes: 0 additions & 42 deletions .github/workflows/danger.yml

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: Deploy SDK documentation to Pages

on:
workflow_dispatch:
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/test.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .swiftlint-global.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parent_config: .swiftlint.yml
included:
- Docs
- Examples
95 changes: 88 additions & 7 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,88 @@
parent_config: .swiftlint_base.yml
excluded:
- .build
- .swiftpm
- Docs
- Examples
- Package.swift
included:
- Sources
- Tests
analyzer_rules:
- unused_declaration
- unused_import
opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- discouraged_none_name
- discouraged_object_literal
- empty_collection_literal
- empty_count
- empty_string
- enum_case_associated_values_count
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- first_where
- flatmap_over_map_reduce
- identical_operands
- joined_default_parameter
- last_where
- legacy_multiple
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- nimble_operator
- nslocalizedstring_key
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_interface_builder
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_type_annotation
- single_test_class
- sorted_first_last
- static_operator
- strong_iboutlet
- test_case_accessibility
- toggle_bool
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition
identifier_name:
excluded:
- id
- to
file_header:
severity: error
required_pattern: |
\/\/
\/\/ Copyright \d{4}(-\d{4})? Pexip AS
\/\/
\/\/ 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\.
Loading

0 comments on commit b5a74ca

Please sign in to comment.