Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
ci: Fix publish (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
udondan authored Apr 10, 2024
1 parent e26750b commit 27d0eb0
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ jobs:
sudo apt-get install -y tree
- name: Build source w/ jsii
run: npx jsii
run: |
lambda/build
npx jsii
make validate-package
- name: Build packages w/ jsii-pacmak
run: |
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,20 @@ jobs:
run: |
set -euo pipefail
make install
(cd test && make install)
sudo apt-get update
sudo apt-get install -y tree
- name: Build source w/ jsii
run: |
lambda/build
npx jsii
make validate-package
- name: Install test dependencies
run: |
cd test
make install
- name: Deploy & Destroy
run: cd test && make deploy DESTROY
env:
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ tsconfig*
lambda/*
!lambda/code.zip
.npm
publish_output.txt
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ eslint:
@echo -e "$(TARGET_COLOR)Running eslint $$(npx eslint --version)$(NO_COLOR)"
@npx eslint .; \
echo "Passed"

validate-package:
@echo -e "$(TARGET_COLOR)Checking package content$(NO_COLOR)"
@npm publish --dry-run 2>&1 | tee publish_output.txt
@\
FILES_TO_CHECK="lambda/code.zip lib/index.d.ts lib/index.js lib/lambda.d.ts lib/lambda.js lib/namedQuery.d.ts lib/namedQuery.js lib/types.d.ts lib/types.js lib/workGroup.d.ts lib/workGroup.js"; \
MISSING_FILES=""; \
for file in $$FILES_TO_CHECK; do \
if ! grep -q $$file publish_output.txt; then \
MISSING_FILES="$$MISSING_FILES $$file"; \
fi; \
done; \
if [ -n "$$MISSING_FILES" ]; then \
echo "❌ The following files are NOT included in the package:$$MISSING_FILES"; \
rm publish_output.txt; \
exit 1; \
fi
@rm publish_output.txt
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
"distName": "cdk-athena",
"module": "cdk_athena"
}
}
},
"excludeTypescript": [
"lambda/**/*.ts",
"test/**/*"
]
},
"devDependencies": {
"@aws-sdk/client-athena": "3.552.0",
Expand Down
3 changes: 1 addition & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ clean:

install: package
@echo Installing dependencies...
@cd .. && make install
@npm install ../cdk-athena-test.tgz --no-save --prefer-offline --cache ../.npm
@npm list

Expand Down Expand Up @@ -33,6 +32,6 @@ package:
@echo Building npm tgz...
@ \
cd .. && \
make build && \
make install build && \
npm pack && \
mv cdk-athena-*.tgz cdk-athena-test.tgz
3 changes: 1 addition & 2 deletions test/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
Tags,
} from 'aws-cdk-lib';
import { Construct } from 'constructs';

import { EncryptionOption, LogLevel, NamedQuery, WorkGroup } from '../../lib';
import { EncryptionOption, LogLevel, NamedQuery, WorkGroup } from 'cdk-athena';

export class TestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
Expand Down

0 comments on commit 27d0eb0

Please sign in to comment.