Skip to content

Commit

Permalink
feat: Build Tool Caches
Browse files Browse the repository at this point in the history
This creates a tool cache that can be used via a cally action for things
like provider building.
  • Loading branch information
techman83 committed May 28, 2024
1 parent 25b6aa4 commit 844a1bf
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-tool-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Tool Cache Archives

on:
workflow_call:
inputs:
version:
type: string
required: true

jobs:
build-archives:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Version
run: |
CALLY_VERSION=${{ inputs.version }}
echo "VERSION = '$CALLY_VERSION'" > src/cally/cli/_version.py
PYTHON_VERSION=$(python3 -c "import sys;print(sys.version_info.minor)")
TOOL_CACHE_PATH="Cally-${CALLY_VERSION}-${RUNNER_OS}-${RUNNER_ARCH}-Python-3.${PYTHON_VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TOOL_CACHE_PATH=${TOOL_CACHE_PATH}" >> $GITHUB_ENV
- name: Install
run: |
pip install . --target ${TOOL_CACHE_PATH} --ignore-installed
find ${TOOL_CACHE_PATH}/bin/. -type f -exec sed -i '1s/.*/#!\/usr\/bin\/env python3/' {} \;
- name: Check install
run: |
export PATH=$PATH:$(pwd)/${TOOL_CACHE_PATH}/bin
export PYTHONPATH=$(pwd)/${TOOL_CACHE_PATH}
cally --version
- name: Build asset
run: cd ${TOOL_CACHE_PATH} && tar -czf ../${TOOL_CACHE_PATH,,}.tar.gz .

- name: Upload asset
run: gh release upload v${{ inputs.version }} ${TOOL_CACHE_PATH,,}.tar.gz
8 changes: 8 additions & 0 deletions .github/workflows/release-cally.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,11 @@ jobs:
draft: false
files: |
dist/cally-${{ needs.build-artifact.outputs.version }}.tar.gz
build-tool-cache:
needs:
- build-artifact
- generate-gh-release
uses: ./.github/workflows/build-tool-cache.yaml
with:
version: ${{ needs.build-artifact.outputs.version }}

0 comments on commit 844a1bf

Please sign in to comment.