Skip to content

Commit

Permalink
fix(ci): switch to workflow templates (#444)
Browse files Browse the repository at this point in the history
* feat(ci): switch to workflow templates for CI

* fix: update package.json script name

* fix: move back to test:cov

* fix: move CI to yarn-berry

---------

Co-authored-by: mdimajo <mathieu.dimajo@oneup.com>
  • Loading branch information
mathieudi and mdimajo committed Nov 13, 2023
1 parent 987eead commit e89866f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 147 deletions.
83 changes: 8 additions & 75 deletions .github/workflows/release.yml
Expand Up @@ -14,79 +14,12 @@ on:
concurrency:
group: release-${{ github.ref }}

env:
NODE_VERSION: 18.x

jobs:
publish:
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Configure package manager
run: |
echo Configuring NPM_TOKEN globally for .npmrc
npm config set '//registry.npmjs.org/:_authToken' ${{ env.NPM_TOKEN }}
yarn config set npmAuthToken ${{ env.NPM_TOKEN }}
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Install dependencies
run: yarn install --immutable

- name: Lint
run: yarn lint

- name: Test
run: yarn test --coverage --silent

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
semantic_version: ^18
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

notification:
if: always()
name: notification
needs: [publish]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- uses: technote-space/workflow-conclusion-action@v3.0.3

- uses: reside-eng/workflow-status-notification-action@v1.2.4
with:
current-status: ${{ env.WORKFLOW_CONCLUSION }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK_PLATFORM_PROD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
name: Reusable release workflow
uses: reside-eng/workflow-templates-library/.github/workflows/release_library.yml@v1
with:
NODE_VERSION: 18.x
PACKAGE_MANAGER: yarn-berry
SLACK_NOTIFICATION_SECRET: SLACK_WEBHOOK_PLATFORM_PROD
secrets: inherit
80 changes: 9 additions & 71 deletions .github/workflows/verify.yml
Expand Up @@ -5,75 +5,13 @@ on:
merge_group:
types: [checks_requested]

env:
NODE_VERSION: 18.x

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Configure package manager
run: |
echo Configuring NPM_READ_TOKEN globally for .npmrc
npm config set '//registry.npmjs.org/:_authToken' ${{ env.NPM_TOKEN }}
yarn config set npmAuthToken ${{ env.NPM_TOKEN }}
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_READ_TOKEN }}

- name: Install dependencies
run: yarn install --immutable

- name: Lint
run: yarn lint

- name: Check types
run: yarn types

- name: Test
run: yarn test:cov

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build package
run: yarn build

- name: Archive workspace on failure
if: failure()
run: zip -r workspace-files ./

- uses: actions/upload-artifact@v3
if: failure()
with:
name: workspace
path: workspace-files.zip

notification:
if: always()
name: notification
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- uses: technote-space/workflow-conclusion-action@v3.0.3

- uses: reside-eng/workflow-status-notification-action@v1.2.4
with:
current-status: ${{ env.WORKFLOW_CONCLUSION }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK_PLATFORM_PROD }}
github-token: ${{ secrets.GITHUB_TOKEN }}
verify:
name: Reusable verify workflow
uses: reside-eng/workflow-templates-library/.github/workflows/verify_library.yml@v1
with:
NODE_VERSION: 18.x
PACKAGE_MANAGER: yarn-berry
SLACK_NOTIFICATION_SECRET: SLACK_WEBHOOK_PLATFORM_PROD
ENABLE_TYPES_CHECK: true
secrets: inherit
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -16,7 +16,7 @@
],
"scripts": {
"lint": "eslint . --ignore-pattern='!.eslintrc.js' --ext .ts,.js --max-warnings 0",
"types": "tsc --noEmit",
"types:check": "tsc --noEmit",
"test": "jest",
"test:cov": "yarn test --coverage --silent",
"build": "yarn build:lib && yarn build:esm",
Expand Down

0 comments on commit e89866f

Please sign in to comment.