From 4648fa8ed7ee63a84673aa4114eca5973fa78f28 Mon Sep 17 00:00:00 2001 From: Lorenzo Vagliano Date: Tue, 22 Oct 2024 16:14:58 +0200 Subject: [PATCH] workflows: added general and pre-commit github workflow --- .github/workflows/pre-commit.yml | 27 +++++++++++++++++++++++++ .github/workflows/pull-request-main.yml | 20 ++++++++++++++++++ .github/workflows/test-and-build.yml | 12 +++++------ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .github/workflows/pull-request-main.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..e15ce6c8 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,27 @@ +name: Pre-Commit + +on: + workflow_call: + inputs: + ref: + description: The reference to build + type: string + required: true + +jobs: + linter: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10.11" + + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 + \ No newline at end of file diff --git a/.github/workflows/pull-request-main.yml b/.github/workflows/pull-request-main.yml new file mode 100644 index 00000000..1d8634a2 --- /dev/null +++ b/.github/workflows/pull-request-main.yml @@ -0,0 +1,20 @@ +name: Pull request main + +on: + pull_request_target: + branches: [main] + paths-ignore: [ "docs/**" ] + +jobs: + test: + uses: ./.github/workflows/test-and-build.yml + with: + ref: ${{ github.event.pull_request.head.sha }} + secrets: inherit + + pre-commit: + uses: ./.github/workflows/pre-commit.yml + with: + ref: ${{ github.event.pull_request.head.sha }} + secrets: inherit + \ No newline at end of file diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 749d65f9..b038011f 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -1,11 +1,11 @@ name: Build and Test on: - push: - branches: - - main - pull_request_target: - branches: - - main + workflow_call: + inputs: + ref: + description: The reference to build + type: string + required: true env: AIRFLOW_HOME: /home/runner/work/workflows/workflows