Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 99 additions & 99 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,113 +58,113 @@ jobs:
exit 1
fi

build-and-test:
needs: [ get-configs, version-and-tag ]
uses: ./.github/workflows/build-and-test.yml
strategy:
fail-fast: true
matrix:
os: [ ubuntu-22.04, windows-latest, macos-latest ]
with:
ref: ${{ needs.version-and-tag.outputs.tag }}
runs-on: ${{ matrix.os }}

bundle-linux:
needs: [ get-configs, version-and-tag, build-and-test ]
strategy:
fail-fast: true
matrix:
include:
- { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
- { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
ref: ${{ needs.version-and-tag.outputs.tag }}
fetch-tags: true

- name: Set release asset name
id: set-asset-name
shell: bash
run: |
APP_NAME=${{ needs.get-configs.outputs.app-name }}
VERSION=$(node -p "require('./package.json').version")
NODE_VERSION=${{ matrix.node-version }}
NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)

TAG=${{ needs.version-and-tag.outputs.tag }}
if [[ "$TAG" =~ -alpha$ ]]; then
FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
elif [[ "$TAG" =~ -beta$ ]]; then
FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
else
FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
fi

ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
# build-and-test:
# needs: [ get-configs, version-and-tag ]
# uses: ./.github/workflows/build-and-test.yml
# strategy:
# fail-fast: true
# matrix:
# os: [ ubuntu-22.04, windows-latest, macos-latest ]
# with:
# ref: ${{ needs.version-and-tag.outputs.tag }}
# runs-on: ${{ matrix.os }}

- name: Set up QEMU
if: matrix.use_qemu
uses: docker/setup-qemu-action@v3

- name: Bundle (${{ matrix.docker-platform }}
run: |
docker run --rm -v ${{ github.workspace }}:/work -w /work \
--platform ${{ matrix.docker-platform }} \
amazonlinux:2023 \
/bin/bash -c '
set -ex
yum install -y make gcc-c++ python3 tar gzip wget tree

wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
export PATH=$PATH:/usr/local/go/bin

curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
nvm install ${{ matrix.node-version }}
nvm use ${{ matrix.node-version }}

npm ci

TAG="${{ needs.version-and-tag.outputs.tag }}"
if [[ "$TAG" =~ -alpha$ ]]; then
npm run bundle:alpha
elif [[ "$TAG" =~ -beta$ ]]; then
npm run bundle:beta
else
npm run bundle:prod
fi

tree -f bundle/production/node_modules/tree-sitter
tree -f bundle/production/node_modules/tree-sitter-json

GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
'

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
path: bundle/production/
if-no-files-found: error
include-hidden-files: true
compression-level: 6
# bundle-linux:
# needs: [ get-configs, version-and-tag, build-and-test ]
# strategy:
# fail-fast: true
# matrix:
# include:
# - { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
# - { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v5
# with:
# ref: ${{ needs.version-and-tag.outputs.tag }}
# fetch-tags: true
#
# - name: Set release asset name
# id: set-asset-name
# shell: bash
# run: |
# APP_NAME=${{ needs.get-configs.outputs.app-name }}
# VERSION=$(node -p "require('./package.json').version")
# NODE_VERSION=${{ matrix.node-version }}
# NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)
#
# TAG=${{ needs.version-and-tag.outputs.tag }}
# if [[ "$TAG" =~ -alpha$ ]]; then
# FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
# elif [[ "$TAG" =~ -beta$ ]]; then
# FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
# else
# FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
# fi
#
# ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
# echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
#
# - name: Set up QEMU
# if: matrix.use_qemu
# uses: docker/setup-qemu-action@v3
#
# - name: Bundle (${{ matrix.docker-platform }}
# run: |
# docker run --rm -v ${{ github.workspace }}:/work -w /work \
# --platform ${{ matrix.docker-platform }} \
# amazonlinux:2023 \
# /bin/bash -c '
# set -ex
# yum install -y make gcc-c++ python3 tar gzip wget tree
#
# wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
# tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
# export PATH=$PATH:/usr/local/go/bin
#
# curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# export NVM_DIR="$HOME/.nvm"
# . "$NVM_DIR/nvm.sh"
# nvm install ${{ matrix.node-version }}
# nvm use ${{ matrix.node-version }}
#
# npm ci
#
# TAG="${{ needs.version-and-tag.outputs.tag }}"
# if [[ "$TAG" =~ -alpha$ ]]; then
# npm run bundle:alpha
# elif [[ "$TAG" =~ -beta$ ]]; then
# npm run bundle:beta
# else
# npm run bundle:prod
# fi
#
# tree -f bundle/production/node_modules/tree-sitter
# tree -f bundle/production/node_modules/tree-sitter-json
#
# GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
# cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
# '
#
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
# path: bundle/production/
# if-no-files-found: error
# include-hidden-files: true
# compression-level: 6

bundle-win-mac:
needs: [ get-configs, version-and-tag, build-and-test ]
needs: [ get-configs, version-and-tag ]
strategy:
fail-fast: true
matrix:
include:
- { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
# - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
- { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
- { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "22.x" }
- { os: "windows-11-arm", arch: "arm64", platform: "win32", go-arch: "arm64", node-version: "22.x" }
# - { os: "windows-11-arm", arch: "arm64", platform: "win32", go-arch: "arm64", node-version: "22.x" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -249,7 +249,7 @@ jobs:
compression-level: 6

release:
needs: [ version-and-tag, bundle-linux, bundle-win-mac ]
needs: [ version-and-tag, bundle-win-mac ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
8 changes: 7 additions & 1 deletion src/app/standalone.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { arch, platform } from 'os';
import { createConnection, ProposedFeatures } from 'vscode-languageserver/node';
import { InitializedParams } from 'vscode-languageserver-protocol';
import { LspCapabilities } from '../protocol/LspCapabilities';
Expand Down Expand Up @@ -33,6 +34,11 @@ async function onInitialize(params: ExtendedInitializeParams) {
},
`${ExtensionName} initializing...`,
);
getLogger().info({
Machine: `${platform()}-${arch()}`,
Process: `${process.platform}-${process.arch}`,
Runtime: `node=${process.versions.node} v8=${process.versions.v8} uv=${process.versions.uv} modules=${process.versions.modules}`,
});
LoggerFactory.initialize(AwsMetadata);
TelemetryService.initialize(ClientInfo, AwsMetadata);

Expand All @@ -46,8 +52,8 @@ async function onInitialize(params: ExtendedInitializeParams) {
}

function onInitialized(params: InitializedParams) {
getLogger().info(`${ExtensionName} initialized`);
(server as any).initialized(params);
getLogger().info(`${ExtensionName} initialized`);
}

function onShutdown() {
Expand Down
34 changes: 22 additions & 12 deletions src/datastore/DataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export enum Persistence {
local = 'local',
}

export enum StoreName {
public_schemas = 'public_schemas',
sam_schemas = 'sam_schemas',
private_schemas = 'private_schemas',
combined_schemas = 'combined_schemas',
}

export interface DataStore {
get<T>(key: string): T | undefined;

Expand All @@ -22,26 +29,24 @@ export interface DataStore {
}

export interface DataStoreFactory extends Closeable {
getOrCreate(store: string): DataStore;
get(store: StoreName): DataStore;

storeNames(): ReadonlyArray<string>;

stats(): unknown;
}

export interface DataStoreFactoryProvider extends Closeable {
get(store: string, persistence: Persistence): DataStore;
get(store: StoreName, persistence: Persistence): DataStore;
}

export class MemoryDataStoreFactoryProvider implements DataStoreFactoryProvider {
private readonly memoryStoreFactory = new MemoryStoreFactory();

get(store: string, _persistence: Persistence): DataStore {
get(store: StoreName, _persistence: Persistence): DataStore {
return this.getMemoryStore(store);
}

getMemoryStore(store: string): DataStore {
return this.memoryStoreFactory.getOrCreate(store);
getMemoryStore(store: StoreName): DataStore {
return this.memoryStoreFactory.get(store);
}

close(): Promise<void> {
Expand All @@ -50,14 +55,19 @@ export class MemoryDataStoreFactoryProvider implements DataStoreFactoryProvider
}

export class MultiDataStoreFactoryProvider implements DataStoreFactoryProvider {
private readonly memoryStoreFactory = new MemoryStoreFactory();
private readonly lmdbStoreFactory = new LMDBStoreFactory();
private readonly memoryStoreFactory: MemoryStoreFactory;
private readonly lmdbStoreFactory: LMDBStoreFactory;

constructor(lmdbStore?: LMDBStoreFactory, memStore?: MemoryStoreFactory) {
this.lmdbStoreFactory = lmdbStore ?? new LMDBStoreFactory();
this.memoryStoreFactory = memStore ?? new MemoryStoreFactory();
}

get(store: string, persistence: Persistence): DataStore {
get(store: StoreName, persistence: Persistence): DataStore {
if (persistence === Persistence.memory) {
return this.memoryStoreFactory.getOrCreate(store);
return this.memoryStoreFactory.get(store);
}
return this.lmdbStoreFactory.getOrCreate(store);
return this.lmdbStoreFactory.get(store);
}

close(): Promise<void> {
Expand Down
Loading
Loading