From 272321a7a0ab5267025d0636377b664386119e18 Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Tue, 12 Sep 2023 23:31:01 -0700 Subject: [PATCH] Enable lint and unit tests Signed-off-by: Eduardo Apolinario --- .github/workflows/checks.yml | 55 ++++++++++++++++++++++++-------- .github/workflows/lint.yml | 27 ++++++++++++++++ .github/workflows/unit-tests.yml | 41 ++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0f02892832..3400d27321 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -18,19 +18,48 @@ jobs: run: | echo "go-version=${{ env.GO_VERSION }}" >> $GITHUB_OUTPUT - # lint: - # name: Lint - # uses: flyteorg/flytetools/.github/workflows/lint.yml@master - # with: - # go-version: "1.19" - - # tests: - # name: Unit Tests - # uses: flyteorg/flytetools/.github/workflows/tests.yml@master - # with: - # go-version: "1.19" - # secrets: - # FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} + lint: + name: Lint + needs: + - unpack-envvars + strategy: + fail-fast: false + matrix: + component: + - datacatalog + - flyteadmin + # TODO(monorepo): Enable lint flytecopilot + # - flytecopilot + - flytecopilot + - flyteidl + - flyteplugins + - flytepropeller + - flytestdlib + uses: ./.github/workflows/lint.yml + with: + go-version: ${{ needs.unpack-envvars.outputs.go-version }} + unit-tests: + name: Unit Tests + needs: + - unpack-envvars + strategy: + fail-fast: false + matrix: + component: + - datacatalog + - flyteadmin + - flytecopilot + # TODO(monorepo): Enable flyteidl unit tests + # flyteidl + - flyteidl + - flyteplugins + - flytepropeller + - flytestdlib + uses: ./.github/workflows/unit-tests.yml + with: + go-version: ${{ needs.unpack-envvars.outputs.go-version }} + secrets: + FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} docker-build: strategy: fail-fast: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..5b65cd0736 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: Lint + +on: + workflow_call: + inputs: + component: + required: true + type: string + go-version: + required: true + type: string +jobs: + lint: + name: Run Lint + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ inputs.component }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ inputs.go-version }} + - name: Lint + run: make install && make lint diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000000..475e010496 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,41 @@ +name: Unit Tests + +on: + workflow_call: + inputs: + component: + required: true + type: string + go-version: + required: true + type: string + secrets: + FLYTE_BOT_PAT: + required: true +jobs: + tests: + name: Run Unit Test + defaults: + run: + working-directory: ${{ inputs.component }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ inputs.go-version }} + - name: Unit Tests + env: + GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }} + run: make install && make test_unit_codecov + # TODO(monorepo): Figure out how to do code coverage aggregation + - name: Push CodeCov + uses: codecov/codecov-action@v3.1.1 + env: + GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }} + with: + file: coverage.txt + flags: unittests + fail_ci_if_error: false