From 47f018110333d5b42de0f90e26b192ad5821025c Mon Sep 17 00:00:00 2001 From: Leon Wright Date: Thu, 21 Mar 2024 15:58:59 +0800 Subject: [PATCH] ci: Use Centralised Build Workflow This converts the workflows to use the centralised provider build --- .github/workflows/build-providers.yaml | 2 +- .github/workflows/coverage-build.yaml | 29 ++++++++-------------- .github/workflows/test-cally.yaml | 34 +++++++++----------------- 3 files changed, 23 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build-providers.yaml b/.github/workflows/build-providers.yaml index 1c54efc..5a219e9 100644 --- a/.github/workflows/build-providers.yaml +++ b/.github/workflows/build-providers.yaml @@ -23,7 +23,7 @@ jobs: id: cache-providers uses: actions/cache@v4 with: - path: build/random/dist/${ matrix.name }}-${{ matrix.version }}.tar.gz + path: build/${{ matrix.provider }}/dist/${ matrix.name }}-${{ matrix.version }}.tar.gz key: cally-provider-${{ matrix.provider }}-${{ matrix.version }} - uses: actions/checkout@v4 if: steps.cache-providers.outputs.cache-hit != 'true' diff --git a/.github/workflows/coverage-build.yaml b/.github/workflows/coverage-build.yaml index 980f2d0..9fb71c6 100644 --- a/.github/workflows/coverage-build.yaml +++ b/.github/workflows/coverage-build.yaml @@ -6,36 +6,27 @@ on: - main jobs: + build-providers: + uses: ./.github/workflows/build-providers.yaml coverage-build: runs-on: ubuntu-latest + needs: build-providers steps: - uses: actions/checkout@v4 + - uses: actions/cache/restore@v3 + id: cache + with: + path: build/random/dist/CallyProvidersRandom-3.6.0.tar.gz + key: cally-provider-random-3.6.0 - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - - name: Install Cally test dependencies - run: pip install .[test] - - name: Restore Provider Packages - id: cache-providers - uses: actions/cache@v4 - with: - path: build/random/dist/CallyProvidersRandom-3.6.0.tar.gz - key: cally-provider-random-3.6.0 - - uses: actions/setup-node@v4 - if: steps.cache-providers.outputs.cache-hit != 'true' - with: - node-version: "20" - - name: Install cdktf-cli and build - if: steps.cache-providers.outputs.cache-hit != 'true' - run: | - npm install cdktf-cli - echo "$(pwd)/node_modules/.bin/" >> $GITHUB_PATH - cally provider build --provider random --version 3.6.0 - (cd build/random && python -m build) - name: Install Provider Pacakge run: pip install build/random/dist/CallyProvidersRandom-3.6.0.tar.gz + - name: Install Cally test dependencies + run: pip install .[test] - name: Run Coverage run: | coverage run -m pytest diff --git a/.github/workflows/test-cally.yaml b/.github/workflows/test-cally.yaml index 479ff99..792256b 100644 --- a/.github/workflows/test-cally.yaml +++ b/.github/workflows/test-cally.yaml @@ -6,43 +6,33 @@ on: - main jobs: + build-providers: + uses: ./.github/workflows/build-providers.yaml pytest: runs-on: ubuntu-latest + needs: build-providers strategy: matrix: python: ["3.11"] steps: + # Restore Provider Packages - uses: actions/checkout@v4 + - uses: actions/cache/restore@v3 + id: cache + with: + path: build/random/dist/CallyProvidersRandom-3.6.0.tar.gz + key: cally-provider-random-3.6.0 - # Cally Testing + # Cally Install - name: Setup Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: pip - - name: Install Cally test dependencies - run: pip install .[test] - - # Provider Packages - - name: Restore Provider Packages - id: cache-providers - uses: actions/cache@v4 - with: - path: build/random/dist/CallyProvidersRandom-3.6.0.tar.gz - key: cally-provider-random-3.6.0 - - uses: actions/setup-node@v4 - if: steps.cache-providers.outputs.cache-hit != 'true' - with: - node-version: "20" - - name: Install cdktf-cli and build - if: steps.cache-providers.outputs.cache-hit != 'true' - run: | - npm install cdktf-cli - echo "$(pwd)/node_modules/.bin/" >> $GITHUB_PATH - cally provider build --provider random --version 3.6.0 - (cd build/random && python -m build) - name: Install Provider Pacakge run: pip install build/random/dist/CallyProvidersRandom-3.6.0.tar.gz + - name: Install Cally test dependencies + run: pip install .[test] # Run Tests - name: Run Pytest