diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index ee2b9ec9..00000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Generate code coverage reports and uploads them to Codecov -name: ๐Ÿ› Code coverage - -on: - push: - branches: ["main"] - pull_request: - types: [opened, synchronize, reopened] - -jobs: - generate: - name: Generate coverage reports - runs-on: ubuntu-latest - timeout-minutes: 5 - defaults: - run: - shell: bash - outputs: - reports_path: ${{ steps.list_reports_path.outputs.reports_path }} - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v3 - with: - node-version-file: .nvmrc - - - name: Install - run: node common/scripts/install-run-rush.js install - - - name: ๐Ÿ— Build - run: node common/scripts/install-run-rush.js rebuild - - - name: ๐Ÿ› Test - run: node common/scripts/install-run-rush.js test --coverage - - - name: List module names for which a coverage report has been generated - id: list_reports_path - # directories_names is an array of strings formatted like that: ./modules/common/coverage. - # syntax checked with https://www.shellcheck.net/ - # https://yaml-multiline.info/ - run: | - reports_path=$(find ./modules -name clover.xml | tr '\n' ',') - echo "reports_path=$reports_path" >> "$GITHUB_OUTPUT" - - - name: โค’ Upload coverage reports - uses: codecov/codecov-action@v3 - with: - fail_ci_if_error: true - files: ${{ steps.list_reports_path.outputs.reports_path }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/lint.yaml similarity index 55% rename from .github/workflows/pr.yaml rename to .github/workflows/lint.yaml index 144b1d12..c22c1a26 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/lint.yaml @@ -1,12 +1,12 @@ -name: ๐Ÿงน Pull request +name: Lint & changelog on: pull_request: types: [opened, synchronize, reopened] jobs: - syntax_changelog: - name: Syntax & changelog + lint: + name: ๐Ÿงน Lint code runs-on: ubuntu-latest timeout-minutes: 5 defaults: @@ -14,50 +14,45 @@ jobs: shell: bash steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 + - name: Checkout code + uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version-file: .nvmrc - - name: Install + - name: Install dependencies run: node common/scripts/install-run-rush.js install - - name: ๐Ÿ— Build + - name: Build projects run: node common/scripts/install-run-rush.js rebuild - - name: ๐Ÿ“ Verify missing changelogs - run: node common/scripts/install-run-rush.js change --target-branch origin/$GITHUB_BASE_REF --verify -v - - - name: ๐Ÿ’… Lint + - name: Lint code # --verbose allows to display warnings from ESLint run: node common/scripts/install-run-rush.js lint --verbose - test: - name: Test + changelog: + name: ๐Ÿ“ Checks for changelogs runs-on: ubuntu-latest timeout-minutes: 5 defaults: run: shell: bash - strategy: - matrix: - node_version: [18, 19, 20, 21] steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 2 - - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node_version }} + node-version-file: .nvmrc - - name: Install + - name: Install dependencies run: node common/scripts/install-run-rush.js install - - name: ๐Ÿ— Build - run: node common/scripts/install-run-rush.js rebuild - - - name: ๐Ÿ› Test - run: node common/scripts/install-run-rush.js test + - name: Checks for changelogs + run: node common/scripts/install-run-rush.js change --target-branch origin/$GITHUB_BASE_REF --verify -v diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e2220d8c..7f8ee4f7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,7 +9,7 @@ # then merged it in the main branch once the publication has been done. # -name: ๐Ÿš€ Publish packages +name: Publish packages on: workflow_dispatch: @@ -43,7 +43,7 @@ env: jobs: simulate: if: inputs.PUBLICATION_MODE == 'simulate' - name: Simulate a publication to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} + name: ๐Ÿš€ Simulate a publication to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} runs-on: ubuntu-latest defaults: run: @@ -52,12 +52,14 @@ jobs: contents: write steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 with: fetch-depth: 2 ref: ${{ env.SOURCE_BRANCH }} - - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -75,7 +77,7 @@ jobs: publish: if: inputs.PUBLICATION_MODE == 'publish' - name: Publish to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} + name: ๐Ÿš€ Publish to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} runs-on: ubuntu-latest defaults: run: @@ -85,12 +87,14 @@ jobs: pull-requests: write steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 with: fetch-depth: 2 ref: ${{ env.SOURCE_BRANCH }} - - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -100,10 +104,10 @@ jobs: name: Heart email: heart@fabernovel.com - - name: Install + - name: Install dependencies run: node common/scripts/install-run-rush.js install - - name: ๐Ÿ— Build + - name: Build projects run: node common/scripts/install-run-rush.js rebuild - name: Create origin/${{ env.TARGET_BRANCH }} branch diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..fe719fa7 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,68 @@ +name: Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + test: + name: ๐Ÿ› Run tests + runs-on: ubuntu-latest + timeout-minutes: 5 + defaults: + run: + shell: bash + strategy: + matrix: + node_version: [18, 19, 20, 21] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + + - name: Install dependencies + run: node common/scripts/install-run-rush.js install + + - name: Build projects + run: node common/scripts/install-run-rush.js rebuild + + - name: Run tests + if: ${{ matrix.node_version != '18' }} + run: node common/scripts/install-run-rush.js test + + - name: Run tests and generate coverage reports + if: ${{ matrix.node_version == '18' }} + run: node common/scripts/install-run-rush.js test --coverage + + - name: Archive code coverage reports + if: ${{ matrix.node_version == '18' }} + uses: actions/upload-artifact@v4 + with: + name: code-coverage-reports + path: modules/**/clover.xml + retention-days: 1 + + coverage: + needs: test + name: โฌ†๏ธ Upload code coverage reports to Codecov + runs-on: ubuntu-latest + timeout-minutes: 5 + defaults: + run: + shell: bash + + steps: + - name: Download reports from previous job + uses: actions/download-artifact@v4 + with: + name: code-coverage-reports + + - name: Upload reports to Codecov + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true