Skip to content

Update custom integration #320

Update custom integration

Update custom integration #320

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Integration testing
on: [push]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js v18.x
uses: actions/setup-node@v3
with:
node-version: v18.x
registry-url: 'https://npm.pkg.github.com'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: pnpm build
env:
LIBRARY_NAME: '@effector/patronum'
- name: Fetch latest package version
id: latest-package-json
run: echo "::set-output name=latest::$(yarn npm info @effector/patronum -f version --json)"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve latest package version from json
uses: sergeysova/jq-action@v2
id: latest-package
with:
cmd: echo "::set-output name=latest-release::$(echo '${{ steps.latest-package-json.outputs.latest }}' | jq .version -r)"
- name: Resolve latest release version
if: ${{ steps.latest-package.outputs.latest-release == '' }}
uses: pozetroninc/github-action-get-latest-release@master
id: github-release
with:
repository: ${{ github.repository }}
excludes: draft
- name: Set version to package from github release
if: ${{ steps.latest-package.outputs.latest-release == '' }}
run: npm version --force --no-git-tag-version ${{ steps.github-release.outputs.release }}
working-directory: './dist/'
- name: Add commit SHA to package version
run: npm version --force --no-git-tag-version prerelease --preid=${{ github.sha }}
working-directory: './dist/'
- name: Publish to Github NPM registry
working-directory: './dist/'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from package.json
uses: sergeysova/jq-action@v2
id: version
with:
cmd: 'jq .version dist/package.json -r'
- name: Published ${{ steps.version.outputs.value }}
run: echo @effector/patronum@${{ steps.version.outputs.value }}
outputs:
version: ${{ steps.version.outputs.value }}
custom:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://npm.pkg.github.com'
- name: Install integration dependencies
run: pnpm install
working-directory: ./integration/custom
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install patronum@${{ needs.build.outputs.version }} to integration package
run: pnpm add @effector/patronum@${{ needs.build.outputs.version }}
working-directory: ./integration/custom
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: pnpm test
working-directory: ./integration/custom
cra:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://npm.pkg.github.com'
- name: Install integration dependencies
run: pnpm install
working-directory: ./integration/cra
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install patronum@${{ needs.build.outputs.version }} to integration package
run: pnpm add @effector/patronum@${{ needs.build.outputs.version }}
working-directory: ./integration/cra
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: pnpm test
working-directory: ./integration/cra