From bfe5b7a1d31de44a15ca52b91807d6b102f14770 Mon Sep 17 00:00:00 2001 From: Dillon Stadther Date: Sat, 24 Aug 2024 15:13:46 -0400 Subject: [PATCH] fix: reduce duplication of setup process --- .github/workflows/docs.yml | 16 +++----- .github/workflows/setup.yml | 20 ++++++++++ .github/workflows/tests.yml | 73 +++++++------------------------------ 3 files changed, 38 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/setup.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index dc19991..17018dc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,24 +7,18 @@ on: workflow_dispatch: jobs: + setup: + uses: ./.github.workflows/setup.yml + build: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - name: "Configure git" run: | git config user.name "CICD" git config user.email "cicd@github.com" - - name: "Install dependencies" - run: | - make init-uv - make install - - name: "Build mkdocs" run: make doc-deploy diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml new file mode 100644 index 0000000..d752bc0 --- /dev/null +++ b/.github/workflows/setup.yml @@ -0,0 +1,20 @@ +name: Setup + +on: + workflow_call: + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + make init-uv + make install diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 44b012f..74ff133 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,39 +8,22 @@ on: - develop jobs: + setup: + uses: ./.github.workflows/setup.yml + format: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - make init-uv - make install - - name: Format checking with Ruff Format run: make format lint: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - make init-uv - make install - - name: Lint with Ruff run: make lint-python @@ -48,56 +31,26 @@ jobs: run: make lint-sql type-check: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - make init-uv - make install - - name: Type checking with Mypy run: make type test: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - make init-uv - make install - - name: Test with pytest run: make test build: + needs: + - setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - make init-uv - make install - - name: Verify build run: make build