Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flows): enforce compilation #1881

Merged
merged 10 commits into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 17 additions & 18 deletions .github/workflows/integration-flows.yaml
Expand Up @@ -7,7 +7,6 @@ on:
- staging/**
pull_request:


concurrency:
group: flows-compile--${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -27,23 +26,23 @@ jobs:

- name: Install nango CLI
run: |
# Build, install CLI and verify it can run
npm install
npm run build -w @nangohq/node -w @nangohq/shared -w nango
npm install -g ./packages/cli
NANGO_CLI_UPGRADE_MODE=ignore nango version --debug
# Build, install CLI and verify it can run
npm install
npm run build -w @nangohq/node -w @nangohq/shared -w nango
npm install -g ./packages/cli
NANGO_CLI_UPGRADE_MODE=ignore nango version --debug

- name: Compile with Nango
run: |
set -e
cd integration-templates
for dir in */; do
if [[ "$dir" != "." && "$dir" != "integration-templates/" ]]; then
cd "$dir"
mkdir -p nango-integrations
find . -maxdepth 1 ! -name '.' ! -name 'nango-integrations' -exec mv -t nango-integrations {} +
cd nango-integrations
NANGO_CLI_UPGRADE_MODE=ignore nango compile
cd ../../
fi
done
set -e
cd integration-templates
for dir in */; do
if [[ "$dir" != "." && "$dir" != "integration-templates/" ]]; then
cd "$dir"
mkdir -p nango-integrations
find . -maxdepth 1 ! -name '.' ! -name 'nango-integrations' -exec mv -t nango-integrations {} +
cd nango-integrations
NANGO_CLI_UPGRADE_MODE=ignore nango compile
cd ../../
fi
done
20 changes: 9 additions & 11 deletions .github/workflows/push-container.yaml
Expand Up @@ -23,21 +23,19 @@ jobs:
- uses: docker/setup-buildx-action@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '18.x'
- uses: docker/login-action@v3
if: env.CAN_PUSH == 'true'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push container
env:
PUSH: ${{ (env.CAN_PUSH == 'true') && '--push' || '' }}
PUSH: ${{ (env.CAN_PUSH == 'true') && '--push' || '' }}
run: |
echo "Building: '${{ inputs.package }}'"
echo "Tags: ${{ inputs.tags }}"

npm i
npm run ${{ inputs.run-cmd }}
node scripts/flows.js
docker buildx build -f packages/${{ inputs.package }}/Dockerfile --platform linux/amd64 ${{ inputs.tags }} . --no-cache ${{ env.PUSH }}
echo "Building: '${{ inputs.package }}'"
echo "Tags: ${{ inputs.tags }}"

npm i
npm run ${{ inputs.run-cmd }}
docker buildx build -f packages/${{ inputs.package }}/Dockerfile --platform linux/amd64 ${{ inputs.tags }} . --no-cache ${{ env.PUSH }}
17 changes: 16 additions & 1 deletion .github/workflows/tests.yaml
Expand Up @@ -7,7 +7,6 @@ on:
- staging/**
pull_request:


concurrency:
group: tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -21,10 +20,26 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm run build:hosted
- run: npm run test:unit
- run: npm run test:integration

- name: Make sure flows.yaml is compiled
run: |
node ./scripts/flows.js

REPO_DIRTY=$(git status --short)
if [[ ! -z "$REPO_DIRTY" ]]; then
git diff
echo ""
echo -e "\r⛔️ flows.yaml hasn't been compiled, please run:"
echo -e "node ./scripts/flows.js"
exit 1
fi
2 changes: 2 additions & 0 deletions .husky/pre-commit
@@ -1,4 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

node ./scripts/flows.js
git add ./packages/shared/flows.yaml
npx lint-staged --allow-empty
29 changes: 17 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -66,6 +66,7 @@
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "^8.0.3",
"js-yaml": "4.1.0",
"lint-staged": "15.2.2",
"onchange": "^7.1.0",
"prettier": "3.2.5",
Expand Down