Bump Foundational Packages to v1 #1247
Workflow file for this run
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
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
security-audit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
# https://cashapp.github.io/hermit/usage/ci/ | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
with: | |
cache: "true" | |
- name: Report known vulnerabilities | |
run: pnpm audit | |
test-with-node: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
with: | |
submodules: true | |
# https://cashapp.github.io/hermit/usage/ci/ | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@31ce88b17a84941bb1b782f1b7b317856addf286 #v1.1.0 | |
with: | |
cache: "true" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build all workspace packages | |
run: pnpm --recursive --stream build:esm && pnpm --recursive --stream build:cjs | |
- name: Run linter for all packages | |
run: pnpm --recursive --stream lint | |
- name: Run dwn-server (background) | |
run: | | |
node node_modules/@web5/dwn-server/dist/esm/src/main.js & | |
echo "DWN_SERVER_BACKGROUND_PROCESS=$!" >> $GITHUB_ENV | |
- name: Build tests for all packages | |
run: pnpm --recursive --stream --sequential build:tests:node | |
- name: Run tests for all packages | |
run: pnpm --recursive --stream exec c8 mocha -- --color | |
env: | |
TEST_DWN_URL: http://localhost:3000 | |
- name: Terminate dwn-server | |
run: kill $DWN_SERVER_BACKGROUND_PROCESS || true | |
- name: Upload test coverage to Codecov | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
test-with-browsers: | |
name: test-with-browsers (group ${{ matrix.group }}) | |
# Run browser tests using macOS so that WebKit tests don't fail under a Linux environment | |
runs-on: macos-14 | |
strategy: | |
# parallelism strategy: agent takes as long as roughly all other pkgs combined. | |
matrix: | |
include: | |
- group: "A" | |
packages: "--filter agent" | |
- group: "B" | |
packages: "--filter credentials ----filter dids --filter identity-agent" | |
- group: "C" | |
packages: "--filter api --filter common" | |
- group: "D" | |
packages: "--filter crypto --filter proxy-agent --filter user-agent" | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
with: | |
submodules: true | |
# https://cashapp.github.io/hermit/usage/ci/ | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
with: | |
cache: "true" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Get Playwright Version (for cache) | |
id: get-playwright-version | |
run: | | |
PLAYWRIGHT_VERSION=$(pnpm --filter dids ls @playwright/test | grep '@playwright/test' | awk 'NR==1{print $2}') | |
echo "Playwright Version: $PLAYWRIGHT_VERSION" | |
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
- name: Restore Cached Playwright Browsers | |
id: cache-playwright-restore | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 | |
with: | |
path: ~/Library/Caches/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- name: Install Playwright Browsers (if no cache) | |
if: steps.cache-playwright-restore.outputs.cache-hit != 'true' | |
run: pnpm --filter dids exec playwright install --with-deps | |
- name: Build esm | |
run: pnpm --recursive --stream build:esm | |
- name: Build browser for matrix ${{ matrix.group }} | |
run: pnpm ${{ matrix.packages }} build:browser | |
- name: Run dwn-server (background) | |
run: | | |
node node_modules/@web5/dwn-server/dist/esm/src/main.js & | |
echo "DWN_SERVER_BACKGROUND_PROCESS=$!" >> $GITHUB_ENV | |
- name: Run tests for matrix ${{ matrix.group }} | |
run: pnpm ${{ matrix.packages }} --sequential test:browser | |
- name: Terminate dwn-server | |
run: kill $DWN_SERVER_BACKGROUND_PROCESS || true |