Merge pull request #29 from CallyCo-io/feat/environments #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build / Cache Providers | |
on: | |
workflow_call: | |
push: | |
branches: | |
- main | |
jobs: | |
check-cache: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-hit: ${{ steps.cache-providers.outputs.cache-hit }} | |
steps: | |
- name: Check Provider Packages | |
id: cache-providers | |
uses: actions/cache@v4 | |
with: | |
path: build/ | |
key: cally-test-providers | |
lookup-only: true | |
build-providers: | |
strategy: | |
matrix: | |
include: | |
- provider: random | |
version: 3.6.0 | |
name: CallyProvidersRandom | |
- provider: google | |
version: 5.21.0 | |
name: CallyProvidersGoogle | |
runs-on: ubuntu-latest | |
needs: check-cache | |
if: needs.check-cache.outputs.cache-hit != 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- name: Install Cally | |
run: pip install .[provider_build] | |
- uses: actions/setup-node@v4 | |
if: steps.cache-providers.outputs.cache-hit != 'true' | |
with: | |
node-version: "20" | |
- name: Install cdktf-cli and build | |
run: | | |
npm install cdktf-cli | |
export PATH=:$(pwd)/node_modules/.bin:$PATH | |
cally provider build --provider ${{ matrix.provider }} --version ${{ matrix.version }} | |
(cd build/${{ matrix.provider }} && python -m build) | |
- name: Install + check package | |
run: | | |
pip install build/${{ matrix.provider }}/dist/*.tar.gz | |
python -c 'import pkgutil,sys; sys.exit(0) if pkgutil.find_loader("cally.providers.${{ matrix.provider }}") else sys.exit(1)' | |
- name: Upload Provider | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.provider }}-${{ matrix.name }}-${{ matrix.version }} | |
path: build/${{ matrix.provider }}/dist/*.tar.gz | |
retention-days: 1 | |
upload-cache: | |
runs-on: ubuntu-latest | |
needs: ['check-cache', 'build-providers'] | |
if: needs.check-cache.outputs.cache-hit != 'true' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build/ | |
- name: Upload Provider Packages | |
id: cache-providers | |
uses: actions/cache@v4 | |
with: | |
path: build/ | |
key: cally-test-providers |