From e7f50fd53c87dcd26d8a0ef8fbcb16bc2c511e17 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Thu, 26 Sep 2024 12:20:18 -0700 Subject: [PATCH] Create Makefiles for test-infra ALI lambdas (#5695) Create Makefiles for the ALI lambda functions so that we can make sure that CI and Local dev use the same commands to build and test. Issue: pytorch/ci-infra#274 Signed-off-by: Thanh Ha --- .../lambda-runner-binaries-syncer.yml | 15 ++------------ .github/workflows/lambda-runners.yml | 12 ++--------- .github/workflows/lambda-webhook.yml | 15 +++----------- .../lambdas/runner-binaries-syncer/Makefile | 20 +++++++++++++++++++ .../modules/runners/lambdas/runners/Makefile | 19 ++++++++++++++++++ .../modules/webhook/lambdas/webhook/Makefile | 19 ++++++++++++++++++ 6 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 terraform-aws-github-runner/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/Makefile create mode 100644 terraform-aws-github-runner/modules/runners/lambdas/runners/Makefile create mode 100644 terraform-aws-github-runner/modules/webhook/lambdas/webhook/Makefile diff --git a/.github/workflows/lambda-runner-binaries-syncer.yml b/.github/workflows/lambda-runner-binaries-syncer.yml index 5c3d42a69e..57cea6f3e0 100644 --- a/.github/workflows/lambda-runner-binaries-syncer.yml +++ b/.github/workflows/lambda-runner-binaries-syncer.yml @@ -19,16 +19,5 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install dependencies - run: yarn install - - name: Run linter - run: yarn lint - - name: Format Check - run: yarn format-check - # TODO: Fix broken tests. - # - name: Run tests - # run: yarn test - - name: Build distribution - run: yarn build - env: - NODE_OPTIONS: "--openssl-legacy-provider" + - name: Build, Lint, and Test + run: make build diff --git a/.github/workflows/lambda-runners.yml b/.github/workflows/lambda-runners.yml index c46500a996..65005778c5 100644 --- a/.github/workflows/lambda-runners.yml +++ b/.github/workflows/lambda-runners.yml @@ -19,13 +19,5 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install dependencies - run: yarn install - - name: Run linter - run: yarn lint - - name: Format Check - run: yarn format-check - - name: Run tests - run: yarn test - - name: Build distribution - run: yarn build + - name: Build, Lint, and Test + run: make build diff --git a/.github/workflows/lambda-webhook.yml b/.github/workflows/lambda-webhook.yml index 8d9b25f193..5019a87572 100644 --- a/.github/workflows/lambda-webhook.yml +++ b/.github/workflows/lambda-webhook.yml @@ -10,6 +10,7 @@ on: jobs: build: + name: "Run tests for webhook lambda" runs-on: ubuntu-latest container: node:20 defaults: @@ -18,15 +19,5 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install dependencies - run: yarn install - - name: Run linter - run: yarn lint - - name: Format Check - run: yarn format-check - - name: Run tests - run: yarn test - - name: Build distribution - run: yarn build - env: - NODE_OPTIONS: "--openssl-legacy-provider" + - name: Build, Lint, and Test + run: make build diff --git a/terraform-aws-github-runner/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/Makefile b/terraform-aws-github-runner/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/Makefile new file mode 100644 index 0000000000..134b2c2457 --- /dev/null +++ b/terraform-aws-github-runner/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/Makefile @@ -0,0 +1,20 @@ +SHELL=/bin/bash -o pipefail + +.PHONY: clean +clean: + rm -rf dist node_modules + rm runner-binaries-syncer.zip + +.PHONY: build +build: + yarn install + yarn lint + yarn format-check + NODE_OPTIONS="--openssl-legacy-provider" yarn build + # TODO: Fix broken tests. + # yarn test + +.PHONY: dist +dist: + yarn install + NODE_OPTIONS="--openssl-legacy-provider" yarn dist diff --git a/terraform-aws-github-runner/modules/runners/lambdas/runners/Makefile b/terraform-aws-github-runner/modules/runners/lambdas/runners/Makefile new file mode 100644 index 0000000000..3eab248263 --- /dev/null +++ b/terraform-aws-github-runner/modules/runners/lambdas/runners/Makefile @@ -0,0 +1,19 @@ +SHELL=/bin/bash -o pipefail + +.PHONY: clean +clean: + rm -rf dist node_modules + rm runners.zip + +.PHONY: build +build: + yarn install + yarn lint + yarn format-check + NODE_OPTIONS="--openssl-legacy-provider" yarn build + yarn test + +.PHONY: dist +dist: + yarn install + NODE_OPTIONS="--openssl-legacy-provider" yarn dist diff --git a/terraform-aws-github-runner/modules/webhook/lambdas/webhook/Makefile b/terraform-aws-github-runner/modules/webhook/lambdas/webhook/Makefile new file mode 100644 index 0000000000..2ab82b3fd2 --- /dev/null +++ b/terraform-aws-github-runner/modules/webhook/lambdas/webhook/Makefile @@ -0,0 +1,19 @@ +SHELL=/bin/bash -o pipefail + +.PHONY: clean +clean: + rm -rf dist node_modules + rm webhook.zip + +.PHONY: build +build: + yarn install + yarn lint + yarn format-check + NODE_OPTIONS="--openssl-legacy-provider" yarn build + yarn test + +.PHONY: dist +dist: + yarn install + NODE_OPTIONS="--openssl-legacy-provider" yarn dist