fix: storybook #674
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: Build | |
on: | |
push: | |
branches: 'main' | |
pull_request: | |
branches: '*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Run build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
# os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.11] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
environment-file: environment.yml | |
activate-environment: datalayer | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install the npm dependencies | |
run: | | |
yarn install | |
- name: Run the build | |
run: | | |
yarn build | |
visual-test: | |
runs-on: ubuntu-latest | |
needs: build | |
name: Stories visual tests | |
timeout-minutes: 60 | |
env: | |
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Setup Node 💾 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- | |
run: | | |
corepack enable | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Setup yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
yarn- | |
- name: Install Dependencies 📥 | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: yarn install | |
- name: Set up browser cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/pw-browsers | |
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} | |
- name: Install Playwright Browsers | |
run: yarn run playwright install chromium --with-deps | |
working-directory: packages/react | |
- name: Run Visual Tests 🧪 | |
run: yarn run test:visual | |
working-directory: packages/react | |
- name: Update Snapshots | |
if: ${{ failure() }} | |
run: | | |
mv test-results test-assets | |
yarn run test:visual -u | |
working-directory: packages/react | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: jupyter-react-test | |
path: | | |
packages/react/test-assets/ | |
packages/react/stories/**/*-snapshots/* | |
docker-dev: | |
# Don't run if the previous case fails | |
needs: build | |
name: Build on dev container | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ".devcontainer/Dockerfile" | |
target: "builder" | |
# For now never push | |
# push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |