ci(gh-actions): bump codecov/codecov-action from 5.0.7 to 5.1.2 #2814
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint: | |
name: Check Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js ${{ vars.NODE_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
cache: npm | |
- name: Install Dependencies | |
run: npm ci --ignore-scripts | |
- name: Lint | |
run: npm run lint | |
build: | |
name: Build Action Assets | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js ${{ vars.NODE_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
cache: npm | |
- name: Install Dependencies | |
run: npm ci --ignore-scripts | |
- name: Build | |
run: npm run build | |
- name: Upload Action Assets | |
uses: actions/[email protected] | |
with: | |
name: dist | |
path: dist | |
include-hidden-files: true | |
unit-test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js ${{ vars.NODE_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
cache: npm | |
- name: Install Dependencies | |
run: npm ci --ignore-scripts | |
- name: Test | |
run: npm test -- --coverage | |
- name: Report Code Coverage to codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
integration-test: | |
name: Integration Test | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04 | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-15 | |
- macos-14 | |
- macos-13 | |
- windows-2022 | |
- windows-2019 | |
runs-on: ${{ matrix.os }} | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Download Action Assets | |
uses: actions/[email protected] | |
with: | |
name: dist | |
path: dist | |
- name: Execute GitHub Action | |
uses: ./ | |
with: | |
image-url: ${{ vars.LGTM_IMAGE_URI }} | |
diff: | |
name: Compare Build Assets | |
if: github.event_name == 'pull_request' | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: ${{ vars.RELEASE_BRANCH }} | |
sparse-checkout: dist | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js ${{ vars.NODE_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
- name: Download Current Action Assets | |
uses: actions/[email protected] | |
with: | |
name: dist | |
path: current | |
- name: Setup js-beautify to compare minified js files | |
run: | | |
npm install --global js-beautify | |
git config --local diff.minjs.textconv js-beautify | |
echo "index.js diff=minjs" > .gitattributes | |
- name: Compare | |
id: compare | |
continue-on-error: true | |
run: git diff --no-index --exit-code ./current/ ./dist/ | |
- name: Report Summary | |
if: steps.compare.outcome == 'failure' | |
continue-on-error: true | |
run: | | |
echo '# Compare ${{ github.sha }} to ${{ github.base_ref }}' >> $GITHUB_STEP_SUMMARY | |
echo '```diff' >> $GITHUB_STEP_SUMMARY | |
git diff --no-index ./current/ ./dist/ >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: Report diff | |
if: steps.compare.outcome == 'failure' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const message = 'There is a difference in the build results.' | |
core.warning(message) | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `${message} [Show More](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})` | |
}) | |
deploy: | |
name: Deploy to Release branch | |
if: github.event_name == 'push' | |
permissions: | |
contents: write | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Release Branch | |
uses: actions/[email protected] | |
with: | |
ref: ${{ vars.RELEASE_BRANCH }} | |
- name: Restore Documents from ${{ github.ref_name }} | |
run: | | |
git fetch --no-tags --depth=1 origin +${{ github.ref }}:refs/remotes/origin/${{ github.ref_name }} | |
git restore --source=origin/${{ github.ref_name }} -- *.md | |
git restore --source=origin/${{ github.ref_name }} -- LICENSE | |
git restore --source=origin/${{ github.ref_name }} -- action.yml | |
git restore --source=origin/${{ github.ref_name }} -- images/*.png | |
git restore --source=origin/${{ github.ref_name }} -- .github/workflows/release.yml | |
- name: Download Build Assets | |
uses: actions/[email protected] | |
with: | |
name: dist | |
path: dist | |
- name: Commit and Push | |
continue-on-error: true | |
run: | | |
git config user.name ${{ vars.GH_ACTIONS_COMMIT_NAME }} | |
git config user.email ${{ vars.GH_ACTIONS_COMMIT_EMAIL }} | |
git add . | |
git commit -m "build: deploy via ${{ github.sha }}" | |
git push |