Skip to content

Commit

Permalink
Add a dedicated workflow for static analysis (#4115)
Browse files Browse the repository at this point in the history
* Add a dedicated workflow for static analysis

---------

Co-authored-by: Simon Dumas <[email protected]>
  • Loading branch information
imsdu and Simon Dumas committed Jul 31, 2023
1 parent 7b9a9c8 commit ddb1f0b
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 70 deletions.
20 changes: 2 additions & 18 deletions .github/workflows/ci-delta-app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Delta App
name: Delta App unit tests
on:
pull_request:
paths:
Expand All @@ -7,23 +7,7 @@ on:
- 'project/**'
- '.github/workflows/ci-delta-app.yml'
jobs:
static-analysis:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Static analysis
run: |
sbt -Dsbt.color=always -Dsbt.supershell=false \
clean \
app-static-analysis
unit-tests:
run:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 20
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/ci-delta-core.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Delta Core
name: Delta Core unit tests
on:
pull_request:
paths:
Expand All @@ -12,24 +12,7 @@ on:
- 'project/**'
- '.github/workflows/ci-delta-core.yml'
jobs:
static-analysis:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Static analysis
run: |
sbt -Dsbt.color=always -Dsbt.supershell=false \
clean \
core-static-analysis
unit-tests:
run:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 20
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/ci-delta-plugins.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Delta Plugins
name: Delta Plugins unit tests
on:
pull_request:
paths:
Expand All @@ -12,23 +12,7 @@ on:
- 'project/**'
- '.github/workflows/ci-delta-plugins.yml'
jobs:
static-analysis:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Static analysis
run: |
sbt -Dsbt.color=always -Dsbt.supershell=false \
clean \
plugins-static-analysis
unit-tests:
run:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 20
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/ci-delta-static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Delta Static analysis
on:
pull_request:
paths:
- 'delta/**'
- 'build.sbt'
- 'project/**'
- '.github/workflows/ci-delta-static-analysis.yml'
jobs:
run:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 20
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Static analysis
run: |
sbt -Dsbt.color=always -Dsbt.supershell=false \
clean \
static-analysis
2 changes: 1 addition & 1 deletion .github/workflows/ci-docs-ext-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:

jobs:
review:
run:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
- '.github/workflows/ci-docs.yml'

jobs:
static-analysis:
run:
if: github.event_name == 'pull_request'
runs-on: it
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-github-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'README.md'

jobs:
review:
run:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'project/**'
- '.github/workflows/ci-integration-tests.yml'
jobs:
integration-tests:
run:
runs-on: it
timeout-minutes: 40
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'project/**'
- '.github/workflows/ci-storage.yml'
jobs:
review:
run:
if: github.event_name == 'pull_request'
runs-on: it
timeout-minutes: 20
Expand Down
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -1035,18 +1035,18 @@ addCommandAlias("build-docs", ";docs/clean;docs/makeSite")
addCommandAlias("preview-docs", ";docs/clean;docs/previewSite")

val coreModules = List("kernel", "rdf", "sdk", "sourcingPsql", "testkit")
def staticAnalysisCommandForModule(module: String) =

val staticAnalysis =
s"""
|;$module/scalafmtCheck
|;$module/Test/scalafmtCheck
|;$module/scalafmtSbtCheck
|;$module/scapegoat
|;$module/doc
|project delta ;
|scalafmtSbtCheck ;
|scalafmtCheck ;
|Test/scalafmtCheck ;
|scapegoat ;
|doc
|""".stripMargin

addCommandAlias("core-static-analysis", coreModules.map(staticAnalysisCommandForModule).mkString)
addCommandAlias("app-static-analysis", staticAnalysisCommandForModule("app"))
addCommandAlias("plugins-static-analysis", staticAnalysisCommandForModule("plugins"))
addCommandAlias("static-analysis", staticAnalysis)

def unitTestsWithCoverageCommandsForModules(modules: List[String]) = {
";coverage" +
Expand Down

0 comments on commit ddb1f0b

Please sign in to comment.