diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0554250 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,93 @@ +name: CI + +on: + push: + branches: + - main + - develop + paths-ignore: + - Docs/** + - README.md + pull_request: + branches: + - develop + paths-ignore: + - Docs/** + - README.md + +env: + DEVELOPER_DIR: /Applications/Xcode_11.6.app/Contents/Developer + +jobs: + test: + runs-on: macOS-latest + env: + MINT_PATH: mint/lib + MINT_LINK_PATH: mint/bin + + steps: + # チェックアウト + - uses: actions/checkout@v2 + + # Bundlerで管理しているライブラリのキャッシュ + - name: Cache Gems + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + + # Bundlerで管理しているライブラリのインストール + - name: Install Bundled Gems + run: make install-bundler + + # Mintのインストール + - name: Install Mint + run: brew install mint + + # Mintで管理しているライブラリのキャッシュ + - name: Cache Mint packages + uses: actions/cache@v2 + with: + path: mint + key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} + restore-keys: | + ${{ runner.os }}-mint- + + # Carthageで管理しているライブラリのキャッシュ + - name: Cache Carthage packages + uses: actions/cache@v2 + with: + path: Carthage + key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} + restore-keys: | + ${{ runner.os }}-carthage- + + # Carthageで管理しているライブラリのインストール + - name: Install Carthage frameworks + run: make install-carthage + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # CocoaPodsで管理しているライブラリのキャッシュ + - name: Cache Pods + uses: actions/cache@v2 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + # プロジェクトファイルの生成、CocoaPodsで管理しているライブラリのインストール + - name: Generate Xcode project and install Pods + run: make generate-xcodeproj + + # ビルド + - name: Xcode build + run: make build-debug + + # 単体テストの実行 + - name: Xcode test + run: make test + diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..a06078c --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,19 @@ +name: SwiftLint + +on: + pull_request: + branches: + - develop + paths: + - '.github/workflows/swiftlint.yml' + - '.swiftlint.yml' + - '**/*.swift' + +jobs: + SwiftLint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.1.0 +