diff --git a/.github/workflows/check-sample.yml b/.github/workflows/check-sample.yml index 045c73d5..801af845 100644 --- a/.github/workflows/check-sample.yml +++ b/.github/workflows/check-sample.yml @@ -25,7 +25,6 @@ jobs: - name: Run Checks id: checks run: | - eval "$(curl -fsSL s.defang.io/install)" ./scripts/check-sample-files.sh > checklist.txt ./scripts/check-modified-samples.sh > modified.txt echo "@@ MODIFIED @@" @@ -33,12 +32,9 @@ jobs: echo "@@ CHECKLIST @@" cat checklist.txt - # TODO: Uncomment the following lines to validate the Compose files - # once we figure out how to prevent it from erroring on warnings. - # - name: Validate Compose Files with Defang CLI - # run: | - # eval "$(curl -fsSL s.defang.io/install)" - # cat modified.txt | xargs -n1 defang compose config -C > /dev/null + - name: Validate Compose Files with Defang CLI + run: | + cat modified.txt | xargs --no-run-if-empty -n1 defang compose config -C - name: Add checklist to PR description uses: actions/github-script@v5 diff --git a/.github/workflows/publish-sample-template.yml b/.github/workflows/publish-sample-template.yml index c572ef2d..4af55875 100644 --- a/.github/workflows/publish-sample-template.yml +++ b/.github/workflows/publish-sample-template.yml @@ -1,14 +1,18 @@ name: Publish Sample Template on: - push: + push: branches: - main + paths: + - 'samples/**' + - 'scripts/template-manager.js' + - 'scripts/check-modified-samples.sh' jobs: publish_samples: runs-on: ubuntu-latest - permissions: + permissions: contents: write pull-requests: write steps: diff --git a/samples/nextjs/app/Dockerfile b/samples/nextjs/app/Dockerfile index 1d13e0a3..2c723cdf 100644 --- a/samples/nextjs/app/Dockerfile +++ b/samples/nextjs/app/Dockerfile @@ -27,4 +27,4 @@ RUN if [ "$NEXT_OUTPUT" = "export" ]; then \ EXPOSE 3000 # Start the app -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] diff --git a/samples/nextjs/app/package.json b/samples/nextjs/app/package.json index d1fa2c99..a551b345 100644 --- a/samples/nextjs/app/package.json +++ b/samples/nextjs/app/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "next start", + "start": "exec next start", "lint": "next lint" }, "dependencies": { diff --git a/tools/testing/deployer/deployer.go b/tools/testing/deployer/deployer.go index f7386dca..9dca17ea 100644 --- a/tools/testing/deployer/deployer.go +++ b/tools/testing/deployer/deployer.go @@ -324,6 +324,7 @@ func (d *CliDeployer) Cleanup(ctx context.Context) error { } func (d *CliDeployer) RunCommand(ctx context.Context, opt func(*exec.Cmd), command string, args ...string) (*exec.Cmd, error) { + log.Printf("Running command in dir %q: %q %q", d.WorkDir, command, args) cmd := exec.CommandContext(ctx, command, args...) cmd.Env = d.EnvVars if d.WorkDir != "" { diff --git a/tools/testing/test/run.go b/tools/testing/test/run.go index 9e46a08f..80357650 100644 --- a/tools/testing/test/run.go +++ b/tools/testing/test/run.go @@ -101,8 +101,8 @@ func Run(ctx context.Context, test TestInfo) (*ItemResult, error) { // declare variable for url var url string - // Regular expression to capture an "https://" URL that follows "will be available at:" - re := regexp.MustCompile(`will be available at:\s*.*?(https://[^\s]+)`) + // Regular expression to capture an "https://" URL that follows "DEPLOYMENT_COMPLETED" + re := regexp.MustCompile(`DEPLOYMENT_COMPLETED\s*((?:https?://)?[^\s]+)`) // Find the first match in the output string match := re.FindStringSubmatch(outputStr)