Skip to content

Commit

Permalink
Migrate to GitHub Actions 🤖
Browse files Browse the repository at this point in the history
At long last, the time as come to say goodbye to Travis CI 👋.

All hail the new king, GitHub Actions 🙌

## Changes

- Setup GitHub Action workflows:
  + `ci.yml` (Build + Test)
  + `pod-lint` (CocoaPods Lint)
  + `release.yml` (GitHub and CocoaPods releases)
  + `spm.yml` (SwiftPM Build)

- Remove .travis.yml.

- Add `Gemfile` and `Gemfile.lock`.
  • Loading branch information
p4checo committed May 7, 2021
1 parent 1221eca commit 0609dcc
Show file tree
Hide file tree
Showing 8 changed files with 304 additions and 66 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches:
- master
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- master

env:
# https://github.com/actions/virtual-environments/tree/main/images/macos
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer

WORKSPACE: Alicerce.xcworkspace
SCHEME: Alicerce

IOS_SDK: iphonesimulator
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 12 Pro,OS=latest"

DERIVED_DATA_PATH: build

jobs:
env-details:
name: Environment details
runs-on: macOS-latest
steps:
- name: xcode version
run: xcodebuild -version -sdk

- name: list simulators
run: |
xcrun simctl delete unavailable
xcrun simctl list
build-test:
name: Build and Test
runs-on: macOS-latest
steps:
- name: git checkout
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: unit tests
run: |
set -o pipefail
xcodebuild clean build test \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-sdk "$IOS_SDK" \
-destination "$IOS_DESTINATION" \
-derivedDataPath "$DERIVED_DATA_PATH" \
-enableCodeCoverage YES | xcpretty -c
- name: codecov upload
uses: codecov/codecov-action@v1
with:
xcode_package: '"^$SCHEME$"'
xcode_derived_data: "$DERIVED_DATA_PATH"
#fail_ci_if_error: true
verbose: true
45 changes: 45 additions & 0 deletions .github/workflows/pod-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CocoaPods Lint

on:
push:
branches:
- master
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- master

env:
# https://github.com/actions/virtual-environments/tree/main/images/macos
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer

jobs:
main:
name: Pod Lint
runs-on: macOS-latest
steps:
- name: git checkout
uses: actions/checkout@v2

- name: ruby versions
run: |
ruby --version
gem --version
bundler --version
- name: cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-

- name: bundle install
run: |
gem install bundler --no-document
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: pod lint
run: bundle exec pod lib lint
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
workflow_run:
workflows: ["CI", "SPM", "CocoaPods Lint"]
types: [completed]

jobs:
deploy-github:
name: Deploy Github
runs-on: macOS-latest
if: startsWith(github.ref, 'refs/tags/') && ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: git checkout
uses: actions/checkout@v2

- name: Build Framework
run: |
carthage build --no-skip-current --cache-builds
carthage archive Alicerce
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: Alicerce.framework.zip
body: |
# Changes
- <!-- Insert changes here -->
deploy-cocoapods:
name: Deploy CocoaPods
runs-on: macOS-latest
if: startsWith(github.ref, 'refs/tags/') && ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: git checkout
uses: actions/checkout@v2

- name: ruby versions
run: |
ruby --version
gem --version
bundler --version
- name: cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-

- name: bundle install
run: |
gem install bundler --no-document
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: pod trunk push
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push --allow-warnings

31 changes: 31 additions & 0 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: SwiftPM Integration

on:
push:
branches:
- master
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- master

env:
# https://github.com/actions/virtual-environments/tree/main/images/macos
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer

PLATFORM_TARGET: x86_64-apple-ios14.0-simulator

jobs:
main:
name: SwiftPM Build
runs-on: macOS-latest
steps:
- name: git checkout
uses: actions/checkout@v2

- name: xcode version
run: xcodebuild -version -sdk

- name: swift build
run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "${PLATFORM_TARGET}"
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions Alicerce.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@
0A3C2CC21EA7E18500EFB7D4 /* Box.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Box.swift; sourceTree = "<group>"; };
0A3C2CC51EA7E18500EFB7D4 /* ServiceLocator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceLocator.swift; sourceTree = "<group>"; };
0A3C2D001EA7E1B500EFB7D4 /* .codecov.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .codecov.yml; sourceTree = "<group>"; };
0A3C2D011EA7E1B500EFB7D4 /* .travis.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .travis.yml; sourceTree = "<group>"; };
0A3C2D021EA7E1B500EFB7D4 /* Alicerce.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Alicerce.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
0A3C2D041EA7E1B500EFB7D4 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
0A3C2D071EA7E1EE00EFB7D4 /* AlicerceTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AlicerceTests-Bridging-Header.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -554,6 +553,8 @@
0A9AF8BB1FC3242E0076458E /* SpecializedGenericTestView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SpecializedGenericTestView.xib; sourceTree = "<group>"; };
0A9AF8BF1FC336F60076458E /* ReusableViewTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReusableViewTestCase.swift; sourceTree = "<group>"; };
0A9AF8C11FC33B070076458E /* ReusableViewCollectionViewTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReusableViewCollectionViewTestCase.swift; sourceTree = "<group>"; };
0AA4EBA6264598AE00616FB3 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
0AA4EBA72645E96900616FB3 /* Gemfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Gemfile; sourceTree = "<group>"; };
0AB34A052085385A001F2979 /* UnfairLockTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnfairLockTestCase.swift; sourceTree = "<group>"; };
0AB34A0720853873001F2979 /* PthreadLockTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PthreadLockTestCase.swift; sourceTree = "<group>"; };
0ABFFAB91EA7F25B00CFC8BD /* Alicerce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Alicerce.h; path = Alicerce.xcodeproj/Alicerce.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -767,13 +768,14 @@
isa = PBXGroup;
children = (
0A3C2D041EA7E1B500EFB7D4 /* README.md */,
0AA4EBA6264598AE00616FB3 /* .github */,
0A933AB3244A2F3800AEBC07 /* .swiftlint.yml */,
0A3C2D011EA7E1B500EFB7D4 /* .travis.yml */,
0A3C2D001EA7E1B500EFB7D4 /* .codecov.yml */,
0A6A4D7524A5F98E0093F174 /* .swiftlint.yml */,
OBJ_6 /* Package.swift */,
0A3C2D021EA7E1B500EFB7D4 /* Alicerce.podspec */,
0A166EDC22107C1600EC6686 /* Brewfile */,
0AA4EBA72645E96900616FB3 /* Gemfile */,
0AFB453C251143ED00698CBB /* Documentation */,
);
name = Metadata;
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.10'
Loading

0 comments on commit 0609dcc

Please sign in to comment.