-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add workflows * Update version management * Add lock files for CI cache * Add release.config.js * Re-enable doc generation * naming nit * Remove circleci * Add PR template * Update docs * temp clear cache * Undo clear cache * temp disable cache * Added macOS and tvOS tests * disable flaky macOS tests * Improve readme * wording nits * cache fix
- Loading branch information
Showing
14 changed files
with
467 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!--- | ||
Thanks for contributing to the Amplitude iOS/tvOS/macOS SDK! 🎉 | ||
Please fill out the following sections to help us quickly review your pull request. | ||
---> | ||
|
||
### Summary | ||
|
||
<!-- What does the PR do? --> | ||
|
||
### Checklist | ||
|
||
* [ ] Does your PR title have the correct [title format](https://github.com/amplitude/Amplitude-iOS/blob/master/CONTRIBUTING.md#pr-commit-title-conventions)? | ||
* Does your PR have a breaking change?: <!-- Yes or no --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Do a dry run to preview instead of a real release' | ||
required: true | ||
default: 'true' | ||
|
||
jobs: | ||
authorize: | ||
name: Authorize | ||
runs-on: macos-10.14 | ||
steps: | ||
- name: ${{ github.actor }} permission check to do a release | ||
uses: octokit/[email protected] | ||
with: | ||
route: GET /repos/:repository/collaborators/${{ github.actor }} | ||
repository: ${{ github.repository }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Release | ||
runs-on: macos-10.14 | ||
needs: [authorize] | ||
strategy: | ||
matrix: | ||
ruby-version: ["2.7.x"] | ||
node-version: ["12.x"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set Xcode 12 | ||
run: | | ||
sudo xcode-select -switch /Applications/Xcode_12.app | ||
- name: Setup Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
|
||
- name: Cache Bundle Gems and Cocoapods | ||
id: cache-gems-pods | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
Pods | ||
vendor/bundle | ||
key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} | ||
|
||
- name: Install Cocoapods | ||
if: steps.cache-gems-pods.outputs.cache-hit != 'true' | ||
run: | | ||
gem install bundler | ||
bundle config path vendor/bundle | ||
bundle install | ||
pod install | ||
- name: iOS Tests | ||
run: | | ||
xcodebuild test \ | ||
-workspace Amplitude.xcworkspace \ | ||
-scheme Amplitude_iOSTests \ | ||
-sdk iphonesimulator \ | ||
-destination 'platform=iOS Simulator,name=iPhone 11,OS=14.0' | ||
# - name: macOS Tests @TODO Fix flaky macOS tests and re-enable | ||
# run: | | ||
# xcodebuild \ | ||
# -workspace Amplitude.xcworkspace \ | ||
# -scheme Amplitude_macOS \ | ||
# -sdk macosx \ | ||
# -destination 'platform=macosx' \ | ||
# test | ||
|
||
- name: tvOS Tests | ||
run: | | ||
xcodebuild \ | ||
-workspace Amplitude.xcworkspace \ | ||
-scheme Amplitude_tvOS \ | ||
-sdk appletvsimulator \ | ||
-destination 'platform=tvOS Simulator,name=Apple TV' \ | ||
test | ||
- name: Validate Podfile | ||
run: | | ||
pod spec lint | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Semantic Release --dry-run | ||
if: ${{ github.event.inputs.dryRun == 'true'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release --dry-run | ||
- name: Semantic Release | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release | ||
- name: Generate docs | ||
run: | | ||
appledoc --project-name Amplitude --project-company "Amplitude Inc" --company-id com.amplitude --no-create-docset --output ./doc/ . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Semantic PR Check | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, edited] | ||
|
||
jobs: | ||
pr-title-check: | ||
name: Check PR for semantic title | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: PR title is valid | ||
if: > | ||
startsWith(github.event.pull_request.title, 'feat:') || startsWith(github.event.pull_request.title, 'feat(') || | ||
startsWith(github.event.pull_request.title, 'fix:') || startsWith(github.event.pull_request.title, 'fix(') || | ||
startsWith(github.event.pull_request.title, 'perf:') || startsWith(github.event.pull_request.title, 'perf(') || | ||
startsWith(github.event.pull_request.title, 'docs:') || startsWith(github.event.pull_request.title, 'docs(') || | ||
startsWith(github.event.pull_request.title, 'test:') || startsWith(github.event.pull_request.title, 'test(') || | ||
startsWith(github.event.pull_request.title, 'refactor:') || startsWith(github.event.pull_request.title, 'refactor(') || | ||
startsWith(github.event.pull_request.title, 'style:') || startsWith(github.event.pull_request.title, 'style(') || | ||
startsWith(github.event.pull_request.title, 'build:') || startsWith(github.event.pull_request.title, 'build(') || | ||
startsWith(github.event.pull_request.title, 'ci:') || startsWith(github.event.pull_request.title, 'ci(') || | ||
startsWith(github.event.pull_request.title, 'chore:') || startsWith(github.event.pull_request.title, 'chore(') || | ||
startsWith(github.event.pull_request.title, 'revert:') || startsWith(github.event.pull_request.title, 'revert(') | ||
run: | | ||
echo 'Title checks passed' | ||
- name: PR title is invalid | ||
if: > | ||
!startsWith(github.event.pull_request.title, 'feat:') && !startsWith(github.event.pull_request.title, 'feat(') && | ||
!startsWith(github.event.pull_request.title, 'fix:') && !startsWith(github.event.pull_request.title, 'fix(') && | ||
!startsWith(github.event.pull_request.title, 'perf:') && !startsWith(github.event.pull_request.title, 'perf(') && | ||
!startsWith(github.event.pull_request.title, 'docs:') && !startsWith(github.event.pull_request.title, 'docs(') && | ||
!startsWith(github.event.pull_request.title, 'test:') && !startsWith(github.event.pull_request.title, 'test(') && | ||
!startsWith(github.event.pull_request.title, 'refactor:') && !startsWith(github.event.pull_request.title, 'refactor(') && | ||
!startsWith(github.event.pull_request.title, 'style:') && !startsWith(github.event.pull_request.title, 'style(') && | ||
!startsWith(github.event.pull_request.title, 'build:') && !startsWith(github.event.pull_request.title, 'build(') && | ||
!startsWith(github.event.pull_request.title, 'ci:') && !startsWith(github.event.pull_request.title, 'ci(') && | ||
!startsWith(github.event.pull_request.title, 'chore:') && !startsWith(github.event.pull_request.title, 'chore(') && | ||
!startsWith(github.event.pull_request.title, 'revert:') && !startsWith(github.event.pull_request.title, 'revert(') | ||
run: | | ||
echo 'Pull request title is not valid. Please check github.com/amplitude/Amplitude-JavaScript/blob/master/CONTRIBUTING.md#pr-commit-title-conventions' | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: macos-10.14 | ||
strategy: | ||
matrix: | ||
ruby-version: ["2.7.x"] | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set Xcode 12 | ||
run: | | ||
sudo xcode-select -switch /Applications/Xcode_12.app | ||
- name: Setup Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
|
||
- name: Cache Bundle Gems and Cocoapods | ||
id: cache-gems-pods | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
Pods | ||
vendor/bundle | ||
key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} | ||
|
||
- name: Install Cocoapods | ||
if: steps.cache-gems-pods.outputs.cache-hit != 'true' | ||
run: | | ||
gem install bundler | ||
bundle config path vendor/bundle | ||
bundle install | ||
pod install | ||
- name: iOS Tests | ||
run: | | ||
xcodebuild test \ | ||
-workspace Amplitude.xcworkspace \ | ||
-scheme Amplitude_iOSTests \ | ||
-sdk iphonesimulator \ | ||
-destination 'platform=iOS Simulator,name=iPhone 11,OS=14.0' | ||
# - name: macOS Tests @TODO Fix flaky macOS tests and re-enable | ||
# run: | | ||
# xcodebuild \ | ||
# -workspace Amplitude.xcworkspace \ | ||
# -scheme Amplitude_macOS \ | ||
# -sdk macosx \ | ||
# -destination 'platform=macosx' \ | ||
# test | ||
|
||
- name: tvOS Tests | ||
run: | | ||
xcodebuild \ | ||
-workspace Amplitude.xcworkspace \ | ||
-scheme Amplitude_tvOS \ | ||
-sdk appletvsimulator \ | ||
-destination 'platform=tvOS Simulator,name=Apple TV' \ | ||
test | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ Carthage/Build | |
|
||
doc/ | ||
.swiftpm | ||
Podfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
### PR Commit Title Conventions | ||
|
||
PR titles should follow [conventional commit standards](https://www.conventionalcommits.org/en/v1.0.0/). This helps automate the [release](#release) process. | ||
|
||
#### Commit Types ([related to release conditions](#release)) | ||
|
||
- **Special Case**: Any commit with `BREAKING CHANGES` in the body: Creates major release | ||
- `feat(<optional scope>)`: New features (minimum minor release) | ||
- `fix(<optional scope>)`: Bug fixes (minimum patch release) | ||
- `perf(<optional scope>)`: Performance improvement | ||
- `docs(<optional scope>)`: Documentation updates | ||
- `test(<optional scope>)`: Test updates | ||
- `refactor(<optional scope>)`: Code change that neither fixes a bug nor adds a feature | ||
- `style(<optional scope>)`: Code style changes (e.g. formatting, commas, semi-colons) | ||
- `build(<optional scope>)`: Changes that affect the build system or external dependencies (e.g. Yarn, Npm) | ||
- `ci(<optional scope>)`: Changes to our CI configuration files and scripts | ||
- `chore(<optional scope>)`: Other changes that don't modify src or test files | ||
- `revert(<optional scope>)`: Revert commit | ||
|
||
### Release [Amplitude Internal] | ||
|
||
Releases are managed by [semantic-release](https://github.com/semantic-release/semantic-release). It is a tool that will scan commits since the last release, determine the next [semantic version number](https://semver.org/), publish, and create changelogs. | ||
|
||
#### Release Conditions [Amplitude Internal] | ||
|
||
- `BREAKING CHANGES` in the body will do a major release | ||
``` | ||
feat(cookies): Create new cookie format | ||
BREAKING CHANGES: Breaks old cookie format | ||
``` | ||
- Else `feat` in title will do a `minor` release | ||
`feat(cookies): some changes` | ||
- Else `fix` or `perf` in title will do a `patch` release | ||
`fix: null check bug` | ||
- Else no release | ||
`docs: update website` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'cocoapods' |
Oops, something went wrong.