blob: f4e17cd80d354b14410802d487b10bc1e570b849 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: 'Setup environment action'
description: 'Setup environment to run jobs'
inputs:
python-version:
required: false
description: 'Install Python version'
default: ''
java-version:
required: false
description: 'Install Java version'
default: ''
go-version:
required: false
description: 'Install Go version'
default: ''
disable-cache:
required: false
description: 'Whether to disable the gradle cache'
default: false
python-cache:
required: false
description: 'Whether to enable Python pip caching'
default: true
tox-cache:
required: false
description: 'Whether to enable tox environment caching'
default: true
runs:
using: "composite"
steps:
- name: Install Python
if: ${{ inputs.python-version != '' }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version == 'default' && '3.10' || inputs.python-version }}
cache: ${{ inputs.python-cache && 'pip' || 'none' }}
cache-dependency-path: |
sdks/python/setup.py
sdks/python/tox.ini
- name: Cache tox environments
if: ${{ inputs.python-version != '' && inputs.tox-cache == 'true' }}
uses: actions/cache@v3
with:
path: |
sdks/python/target/.tox
!sdks/python/target/.tox/**/log
!sdks/python/target/.tox/.package_cache
key: tox-${{ runner.os }}-py${{ inputs.python-version == 'default' && '310' || inputs.python-version }}-${{ hashFiles('sdks/python/tox.ini') }}-${{ hashFiles('sdks/python/setup.py') }}
restore-keys: |
tox-${{ runner.os }}-py${{ inputs.python-version == 'default' && '310' || inputs.python-version }}-${{ hashFiles('sdks/python/tox.ini') }}-
tox-${{ runner.os }}-py${{ inputs.python-version == 'default' && '310' || inputs.python-version }}-
- name: Install Java
if: ${{ inputs.java-version != '' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ inputs.java-version == 'default' && '11' || inputs.java-version }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5
with:
cache-disabled: ${{ inputs.disable-cache }}
validate-wrappers: false
- name: Install Go
if: ${{ inputs.go-version != '' }}
uses: actions/setup-go@v6
with:
go-version: ${{ inputs.go-version == 'default' && '1.25' || inputs.go-version }} # never set patch, to get latest patch releases.
cache-dependency-path: $${{ inputs.disable-cache && '' || 'sdks/go.sum' }}