Skip to content

Commit

Permalink
fix: cli fails to export image on windows (#281)
Browse files Browse the repository at this point in the history
Resolves #280
  • Loading branch information
davydkov authored Sep 1, 2023
1 parent 85e56cd commit cc7e054
Show file tree
Hide file tree
Showing 19 changed files with 537 additions and 138 deletions.
46 changes: 28 additions & 18 deletions .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
name: Bootstrap
description: Checkout the project and install dependencies
description: Init Node.js, caches and install dependencies

inputs:
node-version:
description: 'The version of Node.js to use'
required: false
default: '18'

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: get yarn cache directory
shell: bash
id: yarn-cachedir
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
node-version: ${{ inputs.node-version }}

- name: yarn caches
uses: actions/cache@v3
if: github.ref == 'refs/heads/main'
# if: github.ref == 'refs/heads/main'
with:
path: ${{ steps.yarn-cachedir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
path: |
.yarn/cache
# ${{ github.workspace }}/node_modules/.cache/turbo
key: ${{ runner.os }}-yarn-${{ inputs.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ inputs.node-version }}-
${{ runner.os }}-yarn-
- name: restore only caches
uses: actions/cache/restore@v3
if: github.ref != 'refs/heads/main'
with:
path: ${{ steps.yarn-cachedir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# - name: restore only caches
# uses: actions/cache/restore@v3
# if: github.ref != 'refs/heads/main'
# with:
# path: |
# .yarn/cache
# .yarn/install-state.gz
# node_modules/.cache/turbo
# key: ${{ runner.os }}-yarn-${{ inputs.node-version }}-${{ hashFiles('yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-${{ inputs.node-version }}-
# ${{ runner.os }}-yarn-

- name: install dependencies
shell: bash
env:
YARN_CACHE_FOLDER: .yarn/cache
run: yarn install --immutable
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
if: "github.ref == 'refs/heads/main'"
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ on:
push:
branches:
- 'main'
- 'develop'

permissions:
actions: write
checks: write
contents: read
statuses: write

env:
NODE_ENV: production

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
steps:
- uses: actions/checkout@v3

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize, reopened]

permissions:
actions: write
actions: read
checks: read
contents: read
statuses: write
Expand All @@ -19,7 +19,7 @@ jobs:

build:
name: Build
timeout-minutes: 5
timeout-minutes: 10
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'releases/')"
steps:
Expand All @@ -28,9 +28,6 @@ jobs:
- name: setup
uses: ./.github/actions/bootstrap

- name: turborepo-cache
uses: dtinth/setup-github-actions-caching-for-turbo@v1

- name: Build packages
run: yarn build

Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Test [Push]

on:
push:
tags-ignore:
- "*"
branches-ignore:
- "main"
- "releases/*"

concurrency:
group: ${{ github.ref }}-push-build
cancel-in-progress: true

jobs:
build:
if: "!contains(github.event.head_commit.message, 'ci skip')"
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
node-version: [18, 20]
include:

- node-version: 20
test_cli: true

- os: ubuntu-latest
node-version: 20
build_docs: true

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
node-version: ${{ matrix.node-version }}

- name: Init turborepo-cache
if: runner.os != 'Windows'
uses: dtinth/setup-github-actions-caching-for-turbo@v1

- name: Build and Compile packages
run: yarn ci:build

- name: Test
run: yarn test

- if: ${{ matrix.test_cli }}
name: Run СLI test
run: yarn node integration/like4-cli-tests/run-suit.mjs

- if: ${{ matrix.test_cli }}
name: Upload CLI test artifacts
uses: actions/upload-artifact@v3
with:
name: cli-test-artifacts-${{ matrix.os }}-${{ matrix.node-version }}
path: integration/like4-cli-tests/out/
retention-days: 5

- if: ${{ matrix.build_docs }}
name: Build Docs
working-directory: docs
run: yarn turbo-build
2 changes: 1 addition & 1 deletion .github/workflows/vscode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
if: "github.ref == 'refs/heads/main'"
steps:
- uses: actions/checkout@v3
Expand Down
23 changes: 17 additions & 6 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-check
import nextra from 'nextra'
import { resolve } from 'path'
import { codeImport } from 'remark-code-import'
import { getHighlighter, BUNDLED_LANGUAGES } from 'shiki'
import nextra from 'nextra'
import { resolve } from 'path'
import { codeImport } from 'remark-code-import'
import { getHighlighter, BUNDLED_LANGUAGES } from 'shiki'

const withNextra = nextra({
theme: 'nextra-theme-docs',
Expand Down Expand Up @@ -38,9 +38,11 @@ const withNextra = nextra({
export default withNextra({
reactStrictMode: true,
trailingSlash: true,
// modularizeImports: true,
experimental: {
esmExternals: true,
// swcPlugins: [['@swc-jotai/debug-label', {}]],
//serverComponentsExternalPackages: ['langium','konva']
// swcPlugins: [['@swc-jotai/debug-label', {}]],
},
webpack: function (config, options) {
// config.experiments.asyncWebAssembly = true
Expand All @@ -65,11 +67,20 @@ export default withNextra({
'jotai-devtools',
'monaco-editor',
'monaco-languageclient',
'langium/node',
'langium',
'chevrotain',
'chevrotain-allstar',
'@likec4/core/compute-view',
'@likec4/core/utils',
'@likec4/core/errors',
'@likec4/core/types',
'@likec4/core/colors',
'@likec4/core',
'@likec4/diagrams',
'@likec4/generators',
'@likec4/language-server',
'@likec4/layouts',
'@likec4/layouts'
],
typescript: {
tsconfigPath: './tsconfig.next.json',
Expand Down
1 change: 1 addition & 0 deletions integration/like4-cli-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/*
32 changes: 32 additions & 0 deletions integration/like4-cli-tests/likec4/_spec.c4
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
specification {

element actor {
style {
shape person
}
}

element system
element container
element component
element app

element mobileApp {
style {
shape mobile
}
}

element queue {
style {
shape queue
}
}

element database {
style {
shape storage
}
}

}
66 changes: 66 additions & 0 deletions integration/like4-cli-tests/likec4/amazon/amazon.c4
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
model {

amazon = system 'Amazon' {
description: 'Cloud and managed services provider'

rds = container 'RDS' {
description: 'Relational Databases'
style {
shape cylinder
icon https://icons.terrastruct.com/aws%2FDatabase%2FAmazon-RDS_Amazon-RDS_instance_light-bg.svg
}

pg = database 'PostgreSQL' {
technology 'AWS Aurora'
description: 'Database for storing relational data'
style {
icon https://icons.terrastruct.com/dev%2Fpostgresql.svg
}
}

mysql = database 'MySQL' {
technology 'AWS Aurora'
description: 'Database for storing relational data'
style {
icon https://icons.terrastruct.com/dev%2Fmysql.svg
color indigo
}
}

}

cognito = component 'Cognito' {
description: 'User management and authentication'
}

ses = component 'SES' {
description: 'Email sending'
}

ses -> customer 'sends emails'
}

}

views {

view amazon of amazon {
title: "Overview Amazon"
include *, cloud, cloud.* -> amazon
}

view amazon_rds of rds {
title: 'Overview Amazon RDS'

include *,
amazon,
cloud.backend.* -> rds
}

view amazon_cognito of cognito {
title: 'Overview Amazon Cognito'

include *, amazon
}

}
Loading

0 comments on commit cc7e054

Please sign in to comment.