Skip to content

Commit

Permalink
Configure CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nnsnodnb committed May 4, 2023
1 parent 323c89c commit a7ce6b2
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 25 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Lint

on: [pull_request]

jobs:
actionlint:
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- uses: actions/checkout@v3

- uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-review
level: warning

danger:
runs-on: macos-12

permissions:
pull-requests: write
issues: write
statuses: write
checks: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache SwiftLint
uses: actions/cache@v3
id: cache-swiftlint
with:
path: swiftlint
key: ${{ runner.os }}-swiftlint-${{ hashFiles('swiftlint/swiftlint') }}

- name: Download SwiftLint
if: steps.cache-swiftlint.outputs.cache-hit != 'true'
run: |
version=$(jq -r '.pins[] | select( .identity == "swiftlint" ) | .state.version' < WebSocketClient.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved)
mkdir swiftlint
cd swiftlint
wget "https://github.com/realm/SwiftLint/releases/download/${version}/portable_swiftlint.zip"
unzip portable_swiftlint.zip
cd -
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true

- name: Danger
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bundle exec danger
6 changes: 3 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
included:
WebSocketClient/Sources
WebSocketClientTests
- WebSocketClient/Sources
- WebSocketClientTests

excluded:
WebSocketClient/Generated
- WebSocketClient/Generated

opt_in_rules:
- array_init
Expand Down
3 changes: 3 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github.dismiss_out_of_range_messages

danger.import_dangerfile(path: "scripts/danger/swiftlint.rb")
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ source "https://rubygems.org"
gem "fastlane"
gem "fastlane-plugin-firebase_app_distribution"
gem "fastlane-plugin-xcconfig"
gem "danger"
gem "danger-swiftlint"
47 changes: 46 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,33 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
colored (1.2)
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.3.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 3.0)
faraday-http-cache (~> 2.0)
git (~> 1.13.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 5.0)
terminal-table (>= 1, < 4)
danger-swiftlint (0.33.0)
danger
rake (> 10)
thor (~> 0.19)
declarative (0.0.20)
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
Expand All @@ -55,6 +78,8 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.5.0)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
Expand Down Expand Up @@ -108,6 +133,9 @@ GEM
fastlane-plugin-firebase_app_distribution (0.5.0)
fastlane-plugin-xcconfig (2.0.0)
gh_inspector (1.1.3)
git (1.13.2)
addressable (~> 2.8)
rchardet (~> 1.8)
google-apis-androidpublisher_v3 (0.41.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.0)
Expand Down Expand Up @@ -153,18 +181,29 @@ GEM
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.2)
multi_json (1.15.0)
multipart-post (2.0.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
no_proxy_fix (0.1.2)
octokit (5.6.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
optparse (0.1.1)
os (1.1.4)
plist (3.7.0)
public_suffix (5.0.1)
rake (13.0.6)
rchardet (1.8.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand All @@ -174,6 +213,9 @@ GEM
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
security (0.1.3)
signet (0.17.0)
addressable (~> 2.8)
Expand All @@ -186,6 +228,7 @@ GEM
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.20.3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand Down Expand Up @@ -214,9 +257,11 @@ PLATFORMS
ruby

DEPENDENCIES
danger
danger-swiftlint
fastlane
fastlane-plugin-firebase_app_distribution
fastlane-plugin-xcconfig

BUNDLED WITH
2.4.7
2.4.12
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest

@MainActor
final class ConnectionReducerTests: XCTestCase {
var history: History!
private var history: History!

override func setUp() {
super.setUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import XCTest

@MainActor
final class HistoryDetailReducerTests: XCTestCase {
var history: History!
private var history: History!

override func setUp() {
super.setUp()
Expand Down Expand Up @@ -95,7 +95,7 @@ final class HistoryDetailReducerTests: XCTestCase {
getHistory: { _ in await self.history },
addHistory: { _ in },
updateHistory: { _ in },
deleteHistory: { _ in throw Error.delete}
deleteHistory: { _ in throw Error.delete }
)

await store.send(.confirm)
Expand Down
2 changes: 1 addition & 1 deletion WebSocketClientTests/Reducers/Info/InfoReducerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//

import ComposableArchitecture
import XCTest
@testable import WebSocketClient
import XCTest

@MainActor
final class InfoReducerTests: XCTestCase {
Expand Down
85 changes: 69 additions & 16 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,44 @@ project_type: ios
workflows:
_setup:
steps:
- activate-ssh-key@4: {}
- git-clone@8: {}
- script@1:
run_if: .IsCI
inputs:
- content: rbenv global 3.2.1
title: Switch Ruby version
- cache-pull@2: {}
- restore-spm-cache@1: {}
- restore-cache@1:
inputs:
- key: |-
{{ .OS }}-{{ .Arch }}-rubygems-{{ checksum "Gemfile.lock" }}
{{ .OS }}-{{ .Arch }}-rubygems-
title: Restore rubygems
- script@1:
inputs:
- content: bundle config set --global path './vendor/bundle'
title: Configure Bundler
- install-bundler@1: {}
- save-cache@1:
inputs:
- key: '{{ .OS }}-{{ .Arch }}-rubygems-{{ checksum "Gemfile.lock" }}'
- paths: ./vendor/bundle
title: Save rubygems
- restore-cache@1:
inputs:
- key: |-
{{ .OS }}-{{ .Arch }}-swiftpm-{{ checksum "**/Package.resolved" }}
{{ .OS }}-{{ .Arch }}-swiftpm-
title: Restore Swift Packages
- script@1:
inputs:
- content: bundle exec fastlane resolve_swift_packages
title: Resolve Swift Packages
- save-cache@1:
inputs:
- key: '{{ .OS }}-{{ .Arch }}-swiftpm-{{ checksum "**/Package.resolved" }}'
- paths: ./.swiftpm
- is_key_unique: true
title: Save Swift Packages
- script@1:
inputs:
- content: |-
Expand All @@ -26,33 +55,30 @@ workflows:
title: Write IDESkipPackagePluginFingerprintValidatation
_teardown:
steps:
- save-spm-cache@1: {}
- cache-push@2:
inputs:
- cache_paths: |-
./vendor/bundle -> Gemfile.lock
- script@1:
inputs:
- content: |
if [[ -f fastlane/test_output ]]; then
cp -r fastlane/test_output/* /Users/vagrant/deploy
fi
#!/bin/enb bash
set -ex
if [[ -f Products ]]; then
cp -r Products/* /Users/vagrant/deploy
fi
title: Copy fastlane's ouptuts
- deploy-to-bitrise-io@2:
inputs:
- notify_user_groups: none
_prepare_match:
steps:
- script@1:
inputs:
- content: |
envman add --key MATCH_GIT_PRIVATE_KEY --value "$(echo -n ${GIT_PRIVATE_KEY} | base64 -d)"
title: Add MATCH_GIT_PRIVATE_KEY
adhoc:
before_run:
- _setup
- _prepare_match
steps:
- script@1:
inputs:
- content: |-
envman add --key MATCH_GIT_PRIVATE_KEY --value "$(echo -n ${GIT_PRIVATE_KEY} | base64 -d)"
title: Add MATCH_GIT_PRIVATE_KEY
- file-downloader@1:
inputs:
- source: "${BITRISEIO_FIREBASE_APP_DISTRIBUTION_KEY_URL}"
Expand All @@ -67,6 +93,26 @@ workflows:
- update_fastlane: false
after_run:
- _teardown
appstore:
before_run:
- _setup
- _prepare_match
steps:
- fastlane@3:
inputs:
- lane: "release"
- update_fastlane: false
- github-release@0:
inputs:
- api_token: "${GITHUB_TOKEN}"
- username: "nnsnodnb"
- name: "${BITRISE_GIT_TAG}"
- body: "Release ${BITRISE_GIT_TAG}"
- files_to_upload: |
"Products/WebSocketClient.ipa"
"Products/WebSocketClient.app.dSYM.zip"
after_run:
- _teardown
test:
before_run:
- _setup
Expand All @@ -75,6 +121,10 @@ workflows:
inputs:
- lane: "test"
- update_fastlane: false
- custom-test-results-export@1:
inputs:
- test_name: "WebSocketClient Tests"
- search_pattern: "*/fastlane/test_output/*"
after_run:
- _teardown

Expand All @@ -92,6 +142,9 @@ app:
- opts:
is_expand: false
BITRISE_SCHEME: WebSocketClient
- opts:
is_expand: false
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 20

meta:
bitrise.io:
Expand Down
Loading

0 comments on commit a7ce6b2

Please sign in to comment.