Skip to content

Fix codecov #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 49 additions & 26 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,78 @@
name: "build-and-tests"
on:
pull_request:
push:
branches:
- master

jobs:
discard_runnings_workflows:
name: Discard running workflows
runs-on: ubuntu-20.04
steps:

- name: Cancel running workflows
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
name: Check build & tests
runs-on: apps-ci
needs: discard_runnings_workflows
timeout-minutes: 120
steps:

- name: Remove any previous hook 🥸
run: rm -rf .git/hooks

- name: Checkout 🔎
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache for Gems 💎
uses: actions/cache@v2.1.6
uses: actions/cache@v3
with:
path: |
.gems
~/.bundle
key: ${{ runner.os }}-cache-gems-${{ hashFiles('**/Gemfile.lock') }}

- name: Cache for Carthage 🚚
uses: actions/cache@v2.1.6
with:
path: |
Carthage
key: ${{ runner.os }}-cache-carthage-${{ hashFiles('**/Cartfile.resolved') }}

- name: Rake ⚙️
run: arch -arm64 rake

- name: Run all tests ⚙️
run: arch -arm64 rake tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run iOS tests ⚙️
run: arch -arm64 bundle exec fastlane test_scheme scheme:Mini-iOS configuration:Debug name:iOS

- name: Upload coverage for iOS to Codecov 📋
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: ./output/iOS/Mini-iOS.xcresult
flags: ios
fail_ci_if_error: true
name: codecov-ios

- name: Run tvOS tests ⚙️
run: arch -arm64 bundle exec fastlane test_scheme scheme:Mini-tvOS configuration:Debug name:tv

- name: Upload coverage for tvOS to Codecov 📋
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: ./output/tv/Mini-tvOS.xcresult
flags: tv
fail_ci_if_error: true
name: codecov-tv

- name: Run mac tests ⚙️
run: arch -arm64 bundle exec fastlane test_scheme scheme:Mini-macOS configuration:Debug name:mac

- name: Upload coverage for mac to Codecov 📋
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: ./output/mac/Mini-macOS.xcresult
flags: mac
fail_ci_if_error: true
name: codecov-mac

- name: Validate Podfile ⚙️
run: arch -arm64 rake validate_podfile
Expand All @@ -61,7 +84,7 @@ jobs:
DANGER_GITHUB_API_TOKEN: ${{ secrets.THORBOT_GITHUB_API_TOKEN }}

- name: Save Output 📦
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: output
path: output
path: ${{ github.workspace }}/output
22 changes: 10 additions & 12 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ default_platform(:ios)

platform :ios do
before_all do
ENV['WORKSPACE'] = workspace_path()
ENV['WORKSPACE'] = workspace_path()
end

desc "Pass all test for main target"
lane :pass_tests do
test_scheme(scheme: "Mini-macOS", configuration: "Debug", name: "mac")
sh "curl -s https://codecov.io/bash | bash -s -- -F mac -J 'Mini'"
desc "Pass all test for main target"
lane :pass_tests do
test_scheme(scheme: "Mini-macOS", configuration: "Debug", name: "mac")

test_scheme(scheme: "Mini-tvOS", configuration: "Debug", name: "tv")
sh "curl -s https://codecov.io/bash | bash -s -- -F tv -J 'Mini'"
test_scheme(scheme: "Mini-tvOS", configuration: "Debug", name: "tv")

test_scheme(scheme: "Mini-iOS", configuration: "Debug", name: "iOS")
sh "curl -s https://codecov.io/bash | bash -s -- -F ios -J 'Mini'"
end
test_scheme(scheme: "Mini-iOS", configuration: "Debug", name: "iOS")
end

private_lane :test_scheme do |options|
desc "Pass given scheme tests"
lane :test_scheme do |options|
clear_derived_data

output_directory = File.expand_path("#{ENV['WORKSPACE']}/output")
Expand All @@ -43,5 +41,5 @@ platform :ios do

def workspace_path()
File.expand_path("..")
end
end
end
8 changes: 8 additions & 0 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do

Pass all test for main target

### ios test_scheme

```sh
[bundle exec] fastlane ios test_scheme
```

Pass given scheme tests

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
Expand Down