+ Integration CICD #99
Workflow file for this run
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
name: Build Project | |
on: | |
workflow_call: | |
secrets: | |
token: | |
required: true | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
checklist: | |
name: Checklist Checker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Pull Request Checklist Checker | |
uses: venkatsarvesh/pr-tasks-completed-action@v1.0.0 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Response Status Checklist | |
if: failure() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COMMENT_BODY: "# Check List Not Yet Finish ✅! | |
See more at: ${{ github.event.pull_request.html_url }}/checks | |
" | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
# --edit-last | |
gh pr comment $PR_NUMBER --body "$COMMENT_BODY" || gh pr comment $PR_NUMBER --body "$COMMENT_BODY" | |
checklint: | |
needs: checklist | |
name: Check Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Check SwiftLint | |
uses: norio-nomura/action-swiftlint@3.2.1 | |
with: | |
args: --strict | |
build: | |
name: Setup Enviroment ${{ matrix.swift }} on ${{ matrix.os }} | |
needs: checklint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-14] | |
swift: ["5.9"] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Cache Swift dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.build | |
key: ${{ runner.os }}-swift-${{ hashFiles('**/*.swift') }} | |
restore-keys: | | |
${{ runner.os }}-swift- | |
- name: Set Swift Version | |
uses: swift-actions/setup-swift@v1 | |
with: | |
swift-version: ${{ matrix.swift }} | |
- name: Build | |
id: build | |
run: swift build | |
- name: Run tests | |
run: swift test --enable-code-coverage -v | |
- name: Setup Xcode | |
uses: maxim-lobanov/setup-xcode@v1.4.0 | |
with: | |
xcode-version: latest-stable | |
- name: Get TestResult | |
run: xcodebuild -scheme CalendarView -destination 'platform=iOS Simulator,name=iPhone 12' -resultBundlePath TestResults test | |
- uses: kishikawakatsumi/xcresulttool@v1 | |
if: success() || failure() | |
with: | |
path: TestResults.xcresult | |
show-passed-tests: false | |
show-code-coverage: false | |
upload-bundles: never | |
# - name: Gather code coverage | |
# run: xcrun llvm-cov export -format="lcov" .build/debug/CalendarViewPackageTests.xctest/Contents/MacOS/CalendarViewPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v2 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# fail_ci_if_error: fail | |
# files: ./coverage_report.lcov | |
# verbose: true | |
- name: Return Status Test Fail | |
if: failure() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
COMMENT_BODY: "# 😭 Unit Test Was Failed! | |
See more at: ${{ github.event.pull_request.html_url }}/checks | |
" | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
# --edit-last | |
gh pr comment $PR_NUMBER --body "$COMMENT_BODY" --edit-last || gh pr comment $PR_NUMBER --body "$COMMENT_BODY" | |
- name: Return Status Test Success | |
if: success() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
COMMENT_BODY: "# ✅ Unit Test Success! <3" | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
# --edit-last | |
gh pr comment $PR_NUMBER --body "$COMMENT_BODY" || gh pr comment $PR_NUMBER --body "$COMMENT_BODY" |