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

ci: fixed test matrix #45

Merged
merged 5 commits into from
Jun 11, 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
63 changes: 57 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
token: "${{ github.token }}"
filters: ".github/file-filters.yml"

test:
test-multi-semantic-release:
name: "Test semantic-release version ${{ matrix.semantic_release_version }} on (node-${{ matrix.node_version }}, ${{ matrix.os }})"
if: "needs.files-changed.outputs.packages == 'true'"
needs: "files-changed"
Expand All @@ -60,12 +60,12 @@ jobs:
os:
- "ubuntu-latest"
node_version: ["18", "20", "21", "22"]
semantic_release_version: ["^20", "^21", "^22"]
semantic_release_version: ["^20", "^21", "^22", "^23", "^24"]
# On the other platforms, we only test the lts node version
include:
- os: "macos-latest"
node_version: "20"
semantic_release_version: ["^22"]
semantic_release_version: "^22"
fail-fast: false
runs-on: "${{ matrix.os }}"
env:
Expand Down Expand Up @@ -96,12 +96,63 @@ jobs:
uses: "anolilab/workflows/step/setup@main"
with:
node-version: "${{ matrix.node_version }}"
enable-nx-cache: false

- name: "Install semantic-release version ${{ matrix.semantic_release_version }}"
run: "pnpm i -D semantic-release@${{ matrix.semantic_release_version }}"
run: |
pnpm add -D semantic-release@${{ matrix.semantic_release_version }} --filter=multi-semantic-release
env:
SKIP_CHECK: "true"

- name: "Run tests"
shell: "bash"
run: "pnpm run --filter=multi-semantic-release test"

test-packages:
name: "Test (node-${{ matrix.node_version }}, ${{ matrix.os }})"
if: "needs.files-changed.outputs.packages == 'true'"
needs: "files-changed"
strategy:
max-parallel: 4
matrix:
os:
- "ubuntu-latest"
node_version: ["18", "20", "21", "22"]
# On the other platforms, we only test the lts node version
include:
- os: "macos-latest"
node_version: "20"
fail-fast: false
runs-on: "${{ matrix.os }}"
env:
NODE: "${{ matrix.node_version }}"
steps:
- name: "Harden Runner"
uses: "step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142" # v2.7.0
with:
egress-policy: "audit"

- name: "Git checkout ${{ env.HEAD_REPOSITORY }}:${{ env.HEAD_REF }}"
uses: "actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29" # v4.1.6
env:
GIT_COMMITTER_NAME: "GitHub Actions Shell"
GIT_AUTHOR_NAME: "GitHub Actions Shell"
EMAIL: "github-actions[bot]@users.noreply.github.com"
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Pulls all commits (needed for NX)
fetch-depth: 0

- name: "Derive appropriate SHAs for base and head for `nx affected` commands"
id: "setSHAs"
uses: "nrwl/nx-set-shas@40f1175ceec169e68c9857c27aa7c5063692aa9a" # v4

- name: "Setup resources and environment"
id: "setup"
uses: "anolilab/workflows/step/setup@main"
with:
node-version: "${{ matrix.node_version }}"

# Temporary solution until Nx solve this https://github.com/nrwl/nx/issues/22259
- name: "Get changed files"
id: "files"
Expand Down Expand Up @@ -146,10 +197,10 @@ jobs:
# It symbolizes that all required Frontend checks have succesfully passed (Or skipped)
# This check is the only required GitHub check
test-required-check:
needs: ["files-changed", "test"]
needs: ["files-changed", "test-multi-semantic-release", "test-packages"]
name: "Check Test Run"
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
if: "always() && (needs.test.result == 'success' || needs.test.result == 'skipped')"
if: "always() && (needs.test-packages.result == 'success' || needs.test-packages.result == 'skipped') && (needs.test-multi-semantic-release.result == 'success' || needs.test-multi-semantic-release.result == 'skipped')"
runs-on: "ubuntu-22.04"
steps:
# If any jobs we depend on fail, we will fail since this is a required check
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@
"@anolilab/multi-semantic-release": "^1.1.0",
"@anolilab/prettier-config": "^5.0.14",
"@anolilab/textlint-config": "^8.0.16",
"@babel/core": "^7.24.5",
"@babel/core": "^7.24.7",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@nrwl/tao": "19.0.8",
"@nrwl/workspace": "19.0.8",
"@nrwl/tao": "19.2.3",
"@nrwl/workspace": "19.2.3",
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
"@types/node": "18.18.14",
"audit-ci": "^6.6.1",
"audit-ci": "^7.0.1",
"browserslist-config-anolilab": "^5.0.14",
"commitizen": "^4.3.0",
"cross-env": "^7.0.3",
"husky": "^9.0.11",
"is-ci": "^3.0.1",
"lint-staged": "^15.2.4",
"nx": "^19.0.8",
"lint-staged": "^15.2.6",
"nx": "^19.2.3",
"plop": "^4.0.1",
"prettier": "^3.2.5",
"prettier": "^3.3.2",
"publint": "^0.2.8",
"rimraf": "^5.0.7",
"secretlint": "8.2.4",
Expand All @@ -81,7 +81,7 @@
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"packageManager": "pnpm@9.1.2",
"packageManager": "pnpm@9.3.0",
"engines": {
"node": ">=18.17 <=22.*"
},
Expand All @@ -90,6 +90,7 @@
"@anolilab/multi-semantic-release": "workspace:*",
"@anolilab/rc": "workspace:*",
"@anolilab/semantic-release-pnpm": "workspace:*",
"braces@<3.0.3": ">=3.0.3",
"chrono-node@<2.2.4": ">=2.7.5",
"npm@>=7.9.0 <8.11.0": ">=8.11.0",
"semver@>=7.0.0 <7.5.2": ">=7.5.2"
Expand Down
3 changes: 2 additions & 1 deletion packages/multi-semantic-release/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "bundler"
"moduleResolution": "bundler",
"resolveJsonModule": true
},
"include": ["src/**/*", "*.d.ts"]
}
7 changes: 7 additions & 0 deletions packages/multi-semantic-release/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { readFile } from "fs/promises";

import { getVitestConfig } from "../../tools/get-vitest-config";
import { URL } from "url";

const pkg = JSON.parse(await readFile(new URL("./node_modules/semantic-release/package.json", import.meta.url), { encoding: "utf-8" }));

console.log("\nTesting with semantic-release version", pkg.version, "\n");

const config = getVitestConfig();

Expand Down
Loading
Loading