mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
bc3b6318b6
* chore: update all ci workflows * chore: added readme for tests * chore: fix release branch * Update .github/workflows/release-branch.yml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
177 lines
5.2 KiB
YAML
177 lines
5.2 KiB
YAML
name: Create release branch
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
type:
|
|
type: choice
|
|
description: Choose release type
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
default: patch
|
|
beta:
|
|
type: boolean
|
|
description: Prerelease
|
|
default: false
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
build-and-run-vitest:
|
|
name: Build and run vitest
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: true
|
|
- name: Setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24.x
|
|
cache: npm
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Build project
|
|
run: npm run build
|
|
- name: Install Playwright with deps
|
|
run: npx playwright install --with-deps
|
|
- name: Run unit tests
|
|
run: npm run test:vitest:unit
|
|
- name: Run browser tests
|
|
run: npm run test:vitest:browser:headless
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: axios
|
|
path: dist
|
|
retention-days: 1
|
|
|
|
cjs-smoke-tests:
|
|
name: CJS smoke tests (Node ${{ matrix.node-version }})
|
|
needs: build-and-run-vitest
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [12, 14, 16, 18]
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: true
|
|
- name: Setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: npm
|
|
cache-dependency-path: tests/smoke/cjs/package-lock.json
|
|
- name: Install dependencies
|
|
if: matrix.node-version == 16 || matrix.node-version == 18
|
|
run: npm ci
|
|
- name: Download build artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: axios
|
|
path: dist
|
|
- name: Install CJS smoke test dependencies
|
|
working-directory: tests/smoke/cjs
|
|
run: npm install
|
|
- name: Run CJS smoke tests
|
|
working-directory: tests/smoke/cjs
|
|
run: npm run test:smoke:cjs:mocha
|
|
|
|
esm-smoke-tests:
|
|
name: ESM smoke tests (Node ${{ matrix.node-version }})
|
|
needs: build-and-run-vitest
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [20, 22, 24]
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: true
|
|
- name: Setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: npm
|
|
cache-dependency-path: tests/smoke/esm/package-lock.json
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Download build artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: axios
|
|
path: dist
|
|
- name: Install ESM smoke test dependencies
|
|
working-directory: tests/smoke/esm
|
|
run: npm install
|
|
- name: Run ESM smoke tests
|
|
working-directory: tests/smoke/esm
|
|
run: npm run test:smoke:esm:vitest
|
|
|
|
bump-version-and-create-pr:
|
|
name: Bump version and create PR
|
|
needs: [build-and-run-vitest, cjs-smoke-tests, esm-smoke-tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24.x
|
|
cache: npm
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Configure git identity
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
- name: Bump version with NPM version
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
id: bump-version
|
|
run: |
|
|
TYPE=${{ github.event.inputs.type }}
|
|
BETA=${{ github.event.inputs.beta }}
|
|
if [ "$TYPE" = "auto" ]; then
|
|
npm version $(npm version | grep -Eo 'patch|minor|major' | head -1)
|
|
else
|
|
if [ "$BETA" = "true" ]; then
|
|
npm version $TYPE --preid=beta
|
|
else
|
|
npm version $TYPE
|
|
fi
|
|
fi
|
|
echo "::set-output name=newTag::$(node -p "require('./package.json').version")"
|
|
- name: Bump bower etc
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: npm run preversion
|
|
- name: Build project
|
|
run: npm run build
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v8
|
|
with:
|
|
branch: 'release'
|
|
commit-message: 'chore(release): prepare release ${{ steps.bump-version.outputs.newTag }}'
|
|
body: 'This PR prepares the release ${{ steps.bump-version.outputs.newTag }}.'
|
|
title: 'chore(release): prepare release ${{ steps.bump-version.outputs.newTag }}'
|
|
maintainer-can-modify: true
|
|
draft: false
|
|
labels: |
|
|
type::automated-pr
|
|
priority::high
|
|
commit::chore
|