Skip to content
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

Make build test workflow reusable #22

Merged
merged 3 commits into from
Jun 2, 2024
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
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
name: Pull Request
name: Build, Test and Analyze

on:
pull_request:
branches: [ "main" ]

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
workflow_dispatch:
workflow_call:

jobs:
detekt:
name: Detekt review
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 1
ref: ${{ github.head_ref }}
- name: Detekt PR Check
uses: alaegin/[email protected]
with:
reviewdog_reporter: github-pr-check
github_token: ${{ secrets.github_token }}
fail_on_error: true
detekt_config: internal/detekt-config.yml

buildtestanalyze:
name: Build, test and analyze
buildtestandanalyze:
name: Build, Test and Analyze
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: # needed for CodeQL steps
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ concurrency:
cancel-in-progress: true

jobs:
buildtestanalyze:
uses: ./.github/workflows/build-and-test.yml
buildtestandanalyze:
uses: ./.github/workflows/build-test-analyze.yml
secrets: inherit

uploadartifacts:
name: Archive production artifacts
runs-on: ubuntu-latest
needs: buildtestanalyze
needs: buildtestandanalyze
steps:
- name: Checkout code
uses: actions/[email protected]
Expand All @@ -28,7 +28,7 @@ jobs:

dokka:
runs-on: ubuntu-latest
needs: buildtestanalyze
needs: buildtestandanalyze
steps:
- name: Checkout code
uses: actions/[email protected]
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Pull Request

on:
pull_request:
branches: [ "main" ]

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
detekt:
name: Detekt review
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 1
ref: ${{ github.head_ref }}
- name: Detekt PR Check
uses: alaegin/[email protected]
with:
reviewdog_reporter: github-pr-check
github_token: ${{ secrets.github_token }}
fail_on_error: true
detekt_config: internal/detekt-config.yml

buildtestandanalyze:
uses: ./.github/workflows/build-test-analyze.yml
secrets: inherit

2 changes: 1 addition & 1 deletion internal/guides/Detekt.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Detekt plugin will create several Gradle tasks for the root project and for each

It's important to note that the Detekt task is configured to automatically correct any found violations (if the issue is autocorrectable); otherwise, the fix should be performed manually.

Furthermore, Detekt is configured as a job in a [Github action](https://github.com/alaegin/Detekt-Action?tab=readme-ov-file) to run on every [pull request](../../.github/workflows/build-and-test.yml) pointing to the main project branch. The job is configured to comment violations in the `Files changed` section of the pull request.
Furthermore, Detekt is configured as a job in a [Github action](https://github.com/alaegin/Detekt-Action?tab=readme-ov-file) to run on every [pull request](../../.github/workflows/pull-request.yml) pointing to the main project branch. The job is configured to comment violations in the `Files changed` section of the pull request.

## Android Studio and local setup

Expand Down
Loading