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

automate testing the preset is working with semantic-release #96

Open
sheerlox opened this issue Sep 30, 2023 · 0 comments
Open

automate testing the preset is working with semantic-release #96

sheerlox opened this issue Sep 30, 2023 · 0 comments

Comments

@sheerlox
Copy link
Member

been trying to automate a dry-run in GitHub Actions so Renovate PRs would fail if the latest semantic-release version is not compatible.

this is blocked by semantic-release/semantic-release#1890.

here's what I came with before realizing it was impossible for now (updated test.yml):

name: Lint & Test

on:
  workflow_call:
  pull_request:
    branches:
      - main

jobs:
  lint-and-test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
      - name: Get branch name
        id: branch-name
        uses: tj-actions/branch-names@033f2358d95522973eee35810e35a86fae4a71d8 # v7
      - name: Checkout project
        uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
        with:
          ref: ${{ steps.branch-name.outputs.current_branch }}
      - name: Use Node.js
        uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
        with:
          node-version: 'lts/*'
      - name: Install packages
        run: npm ci
      - name: Check codestyle compliance
        run: npm run lint
      - name: Setup Git for tests
        run: |
          git config --global user.email "user@test.com"
          git config --global user.name "Test User"
      - name: Run tests
        run: npm run test
      - name: Run Semantic Release (dry-run mode)
        run: npm run release -- --no-ci --dry-run --branches ${{ steps.branch-name.outputs.current_branch }}
        env:
          GITHUB_ACTIONS: ''
          GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - name: Upload coverage reports to Codecov
        if: ${{ matrix.os == 'ubuntu-latest' }}
        uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: coverage/coverage-final.json
          fail_ci_if_error: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant