@zio.dev/zio-sbt 0.8.10 → 0.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/concepts/generated-files.md +22 -0
  2. package/concepts/how-the-plugins-fit-together.md +29 -0
  3. package/concepts/index.md +10 -0
  4. package/getting-started.md +91 -0
  5. package/how-to-guides/add-a-service-container-to-a-job.md +28 -0
  6. package/how-to-guides/auto-approve-and-auto-merge-dependency-update-prs.md +36 -0
  7. package/how-to-guides/build-a-workflow-of-only-custom-jobs.md +15 -0
  8. package/how-to-guides/change-the-workflow-environment.md +12 -0
  9. package/how-to-guides/configure-dependabot-updates.md +24 -0
  10. package/how-to-guides/configure-scala-steward.md +16 -0
  11. package/how-to-guides/control-ci-concurrency.md +30 -0
  12. package/how-to-guides/customize-the-generated-ci-jobs.md +54 -0
  13. package/how-to-guides/customize-the-generated-readme.md +36 -0
  14. package/how-to-guides/draft-releases-with-release-drafter.md +16 -0
  15. package/how-to-guides/enable-netlify-deploy-previews.md +42 -0
  16. package/how-to-guides/keep-the-workflow-in-sync.md +12 -0
  17. package/how-to-guides/publish-a-releases-docs-again.md +18 -0
  18. package/how-to-guides/regenerate-workflows-on-bot-prs.md +15 -0
  19. package/how-to-guides/set-job-timeouts.md +17 -0
  20. package/how-to-guides/test-against-several-scala-and-java-versions.md +101 -0
  21. package/index.md +25 -733
  22. package/package.json +1 -1
  23. package/reference/ci.md +148 -0
  24. package/reference/ecosystem.md +141 -0
  25. package/reference/githubactions.md +51 -0
  26. package/reference/index.md +15 -0
  27. package/reference/source.md +109 -0
  28. package/reference/website.md +103 -0
  29. package/sidebars.js +57 -3
  30. package/tutorials/set-up-a-new-zio-library.md +141 -0
@@ -0,0 +1,101 @@
1
+ ---
2
+ id: test-against-several-scala-and-java-versions
3
+ title: "Test Against Several Scala and Java Versions"
4
+ ---
5
+
6
+ ## Default Testing Strategy
7
+
8
+ The default testing strategy for ZIO SBT CI plugin is to run `sbt +test` on Corretto Java 17, 21 and 25. So this will generate the following job:
9
+
10
+ ```yaml
11
+ test:
12
+ name: Test
13
+ runs-on: ubuntu-latest
14
+ continue-on-error: false
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ java: ['17', '21', '25']
19
+ steps:
20
+ - name: Setup Scala
21
+ uses: actions/setup-java@v5
22
+ with:
23
+ distribution: corretto
24
+ java-version: ${{ matrix.java }}
25
+ check-latest: true
26
+ - name: Cache Dependencies
27
+ uses: coursier/cache-action@v6
28
+ - name: Git Checkout
29
+ uses: actions/checkout@v6
30
+ with:
31
+ fetch-depth: '0'
32
+ - name: Test
33
+ run: sbt --no-colors +test
34
+ ```
35
+
36
+ The `sbt +test` command will run the `test` task for all submodules in the project against all Scala versions defined in the `crossScalaVersions` setting.
37
+
38
+ ## Concurrent Testing Strategy
39
+
40
+ In some cases, we may have multiple submodules in our project and we want to test them concurrently using GitHub Actions matrix strategy.
41
+
42
+ The `ciTargetScalaVersions` setting key is used to define a mapping of project names to the Scala versions that should be used for testing phase of continuous integration (CI).
43
+
44
+ For example, suppose we have a project with the name "submoduleA" and we want to test it against Scala `2.12.20`, and for the "submoduleB" we want to test it against Scala `2.12.20` and `2.13.18` and `3.3.7`, We can define the `ciTargetScalaVersions` setting as follows:
45
+
46
+ ```scala
47
+ ThisBuild / ciTargetScalaVersions := Map(
48
+ "submoduleA" -> Seq("2.12.20"),
49
+ "submoduleB" -> Seq("2.12.20", "2.13.18", "3.3.7")
50
+ )
51
+ ```
52
+
53
+ In the example provided, `ciTargetScalaVersions` is defined at the `ThisBuild` level, meaning that the setting will apply to all projects within the build. The setting defines a Map where the key is the name of the current project, obtained by calling the `id` method on the `thisProject` setting, and the value is a sequence of Scala versions obtained from the `crossScalaVersions` of each submodule setting.
54
+
55
+ To simplify this process, we can populate the versions using each submodule's crossScalaVersions setting as follows:
56
+
57
+ ```scala
58
+ ThisBuild / ciTargetScalaVersions := Map(
59
+ (submoduleA / thisProject).value.id -> (submoduleA / crossScalaVersions).value,
60
+ (submoduleB / thisProject).value.id -> (submoduleB / crossScalaVersions).value
61
+ )
62
+ ```
63
+
64
+ The above code can be simplified further by using `targetScalaVersionsFor` helper method, it takes a list of submodules and returns a Map of project names to their `crossScalaVersions`:
65
+
66
+ ```scala
67
+ ThisBuild / ciTargetScalaVersions := targetScalaVersionsFor(submoduleA, submoduleB).value
68
+ ```
69
+
70
+ This will generate the following job:
71
+
72
+ ```yaml
73
+ test:
74
+ name: Test
75
+ runs-on: ubuntu-latest
76
+ continue-on-error: false
77
+ strategy:
78
+ fail-fast: false
79
+ matrix:
80
+ java: ['17', '21', '25']
81
+ scala-project:
82
+ - ++2.12.20 submoduleA
83
+ - ++2.12.20 submoduleB
84
+ - ++2.13.18 submoduleB
85
+ - ++3.3.7 submoduleB
86
+ steps:
87
+ - name: Setup Scala
88
+ uses: actions/setup-java@v5
89
+ with:
90
+ distribution: corretto
91
+ java-version: ${{ matrix.java }}
92
+ check-latest: true
93
+ - name: Cache Dependencies
94
+ uses: coursier/cache-action@v6
95
+ - name: Git Checkout
96
+ uses: actions/checkout@v6
97
+ with:
98
+ fetch-depth: '0'
99
+ - name: Test
100
+ run: sbt --no-colors ${{ matrix.scala-project }}/test
101
+ ```