Update dependency axios-mock-adapter to v2 #809
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
# This is the entry point for CI. It will setup the application, then run lint, test, and eventually publish if not the main branch | |
name: 'Main' | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
concurrency: build-${{ github.ref}} | |
if: ${{ !startsWith(github.head_ref, 'version-bump') }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup | |
- run: yarn build | |
lint: | |
runs-on: ubuntu-latest | |
concurrency: lint-${{ github.ref }} | |
if: ${{ !startsWith(github.head_ref, 'version-bump') }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup | |
- run: yarn lint | |
- run: yarn prettier --check "**/*.{ts,md}" | |
test: | |
concurrency: test-${{ github.ref }} | |
runs-on: ubuntu-latest | |
if: ${{ !startsWith(github.head_ref, 'version-bump') }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup | |
- run: | | |
# Check for test.only() in test files | |
set +e | |
files=$(find ${{ github.workspace }}/test -name "*.test.ts" | xargs grep -l 'test.only') | |
set -e | |
if [[ -n $files ]]; then | |
echo "Error: Found /test.only/ in following test files:" | |
echo "$files" | |
exit 1 | |
fi | |
- run: yarn test | |
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: coverage-reports | |
path: | | |
./**/coverage/tmp/*.json | |
./**/coverage/coverage-summary.json | |
# Only run if tests have run and completed successfully | |
code-coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ !startsWith(github.head_ref, 'version-bump') }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: coverage-reports | |
- run: yarn code-coverage | |
- uses: ./.github/actions/set-git-credentials | |
- name: Save coverage summary | |
if: github.event.pull_request.number # check if the context is pull request | |
run: | | |
# save coverage summary in a branch 'coverage-pr-PR_NUMBER' so we can have access to it in a different workflow | |
BRANCH="coverage-pr-${{ github.event.pull_request.number }}" | |
git checkout -b $BRANCH | |
git add -f coverage/coverage-summary.json | |
git commit -m "coverage summary report" | |
git push --set-upstream origin $BRANCH --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
generate-example-adapter: | |
runs-on: ubuntu-latest | |
if: ${{ !startsWith(github.head_ref, 'version-bump') }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/setup | |
- name: Generate new adapter, build, run the tests | |
run: | | |
yarn build | |
path_to_generator="$GITHUB_WORKSPACE/dist/src/generator-adapter" | |
npm install -g [email protected] | |
# The command bellow will generate new EA with default name 'example-adapter' in specified directory 'examples' | |
yo "$path_to_generator" examples | |
cd examples/example-adapter | |
yarn build | |
yarn test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EXTERNAL_ADAPTER_GENERATOR_NO_INTERACTIVE: 'true' | |
EXTERNAL_ADAPTER_GENERATOR_STANDALONE: 'true' |