Merge pull request #488 from crazy-max/test-node-multi

ci: test supported node versions
This commit is contained in:
CrazyMax 2024-11-22 18:04:24 +01:00 committed by GitHub
commit d99f9fda4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 1 deletions

View File

@ -15,6 +15,12 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node_version:
- 20
- 18
steps: steps:
- -
name: Checkout name: Checkout
@ -24,3 +30,5 @@ jobs:
uses: docker/bake-action@v5 uses: docker/bake-action@v5
with: with:
targets: build targets: build
env:
NODE_VERSION: ${{ matrix.node_version }}

View File

@ -21,6 +21,12 @@ env:
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node_version:
- 20
- 18
steps: steps:
- -
name: Checkout name: Checkout
@ -32,6 +38,7 @@ jobs:
targets: test-coverage targets: test-coverage
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_VERSION: ${{ matrix.node_version }}
- -
name: Check coverage name: Check coverage
run: | run: |
@ -44,7 +51,7 @@ jobs:
- -
name: Upload coverage name: Upload coverage
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
if: env.RUN_CODECOV == 'true' if: env.RUN_CODECOV == 'true' && matrix.node_version == env.NODE_VERSION
with: with:
files: ./coverage/clover.xml files: ./coverage/clover.xml
flags: unit flags: unit

View File

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
variable "NODE_VERSION" {
default = null
}
group "default" { group "default" {
targets = ["build"] targets = ["build"]
} }
@ -24,31 +28,42 @@ group "validate" {
targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"] targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"]
} }
target "_common" {
args = {
NODE_VERSION = NODE_VERSION
}
}
target "build" { target "build" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "build-update" target = "build-update"
output = ["."] output = ["."]
} }
target "format" { target "format" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "format-update" target = "format-update"
output = ["."] output = ["."]
} }
target "lint" { target "lint" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "lint" target = "lint"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "vendor" { target "vendor" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "vendor-update" target = "vendor-update"
output = ["."] output = ["."]
} }
target "vendor-validate" { target "vendor-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "vendor-validate" target = "vendor-validate"
output = ["type=cacheonly"] output = ["type=cacheonly"]
@ -67,6 +82,7 @@ target "dockerfile-validate" {
} }
target "test" { target "test" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "test" target = "test"
output = ["type=cacheonly"] output = ["type=cacheonly"]
@ -74,6 +90,7 @@ target "test" {
} }
target "test-coverage" { target "test-coverage" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "test-coverage" target = "test-coverage"
output = ["./coverage"] output = ["./coverage"]
@ -87,6 +104,7 @@ variable "GITHUB_REF" {
} }
target "publish" { target "publish" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
args = { args = {
GITHUB_REF = GITHUB_REF GITHUB_REF = GITHUB_REF