Skip to content

ci: Update test workflow to include vsce packaging #1727

ci: Update test workflow to include vsce packaging

ci: Update test workflow to include vsce packaging #1727

Workflow file for this run

name: Test CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
pull-requests: write
jobs:
build-artifact:
name: Build And Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '21.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore node_modules
uses: actions/cache/restore@v4
id: restore-node-modules
with:
path: |
node_modules
packages/**/node_modules
!node_modules/@data-story
!packages/*/node_modules/@data-story
!**/node_modules/.cache
!**/node_modules/**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Restore Turbo cache
uses: actions/cache/restore@v4
id: restore-turbo-cache
with:
path: .turbo/cache
key: ${{ runner.os }}-turbo-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Restore Cypress cache
uses: actions/cache/restore@v4
id: restore-cypress-cache
with:
path: /home/runner/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-cypress-
# Install dependencies (only when cache is not hit)
- name: Install dependencies
if: |
steps.restore-node-modules.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: cypress install
if: |
steps.restore-cypress-cache.outputs.cache-hit != 'true'
run: |
# run yarn cypress verify, if it fails, run yarn cypress install
if ! yarn cypress verify; then
yarn cypress install
fi
- name: Build and Test
run: |
yarn turbo run build
# skipping testing ds-ext for now
yarn turbo run test --filter=!ds-ext
npm install -g @vscode/[email protected]
cd packages/ds-ext
mkdir ../../dist
vsce package --no-yarn --skip-license -o ../../dist/
- name: Upload ds-ext
uses: actions/upload-artifact@v4
if: |
github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
with:
name: ds-ext
path: |
dist/
retention-days: 3
- name: Upload build dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifacts
path: |
packages/core/dist
packages/ui/dist
packages/nodejs/dist
packages/hubspot/dist
packages/ds-ext/dist
packages/docs/dist
retention-days: 1
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
if: |
github.event_name == 'pull_request'
with:
comment-tag: ds-ext-artifact
message: |
Checkout ds-ext artifact: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# Save node_modules (always execute)
- name: Save node_modules
if: success()
uses: actions/cache/save@v4
with:
path: |
node_modules
packages/**/node_modules
!node_modules/@data-story
!packages/*/node_modules/@data-story
!**/node_modules/.cache
!**/node_modules/**/node_modules
key: ${{ steps.restore-node-modules.outputs.cache-primary-key }}
# Save Turbo cache (always execute)
- name: Save Turbo cache
if: success()
uses: actions/cache/save@v4
with:
path: .turbo/cache
key: ${{ steps.restore-turbo-cache.outputs.cache-primary-key }}
# Save Cypress cache (always execute)
- name: Save Cypress cache
if: success()
uses: actions/cache/save@v4
with:
path: /home/runner/.cache/Cypress
key: ${{ steps.restore-cypress-cache.outputs.cache-primary-key }}
- name: Cleanup
if: always()
run: yarn cache clean