Build and Tests #46
Workflow file for this run
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 and Tests | |
on: | |
push: | |
pull_request: | |
jobs: | |
get_scala_versions: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: tpunder/cross-scala-versions@master | |
id: run | |
outputs: | |
sbt_versions: ${{ steps.run.outputs.sbt_versions }} | |
# This builds and runs local tests | |
build: | |
needs: get_scala_versions | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
#os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] | |
os: [ 'ubuntu-latest' ] | |
java: [ '8', '11', '17' ] | |
sbt: ${{ fromJson(needs.get_scala_versions.outputs.sbt_versions) }} | |
name: Build/Test - SBT ${{ matrix.sbt }}, Java ${{ matrix.Java }} (${{ matrix.os }}) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
- run: sbt ^^${{ matrix.sbt }} test | |
# This runs the SBT "scripted" tests | |
scripted: | |
needs: build # Don't bother running the scripted tests if the main build/test fails. | |
runs-on: ${{ matrix.os }} | |
environment: fm-sbt-s3-resolver-example-bucket # This is the GitHub environment that holds the AWS secrets referenced below | |
strategy: | |
fail-fast: false | |
matrix: | |
#os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] | |
os: [ 'ubuntu-latest' ] | |
java: [ '8', '11', '17' ] | |
sbt: | |
- 0.13.18 | |
- 1.1.6 | |
- 1.2.8 | |
- 1.3.13 | |
- 1.4.9 | |
- 1.5.8 | |
- 1.6.1 | |
exclude: | |
# These SBT versions don't work on Java 17 | |
- sbt: 1.1.6 | |
java: 17 | |
- sbt: 1.2.8 | |
java: 17 | |
name: Scripted - SBT ${{ matrix.sbt }}, Java ${{ matrix.Java }} (${{ matrix.os }}) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
# | |
# Test using S3 if we can access the secrets | |
# | |
# This will publishLocal for all crossSbtVersions then test example apps | |
# using the matrix.sbt version. For example we will publish the 0.13 and | |
# 1.0 compatible versions of the plugin (via our configured | |
# crossSbtVersions) and then test using a wider range of SBT versions. | |
- run: sbt -v ^publishLocal ^^${{ matrix.sbt }} scripted | |
if: ${{ github.event_name == 'push' }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
# | |
# Test using LocalStack if no access to secrets | |
# | |
- name: Start LocalStack | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
# install LocalStack cli and awslocal | |
pip install localstack awscli-local[ver1] | |
# Make sure to pull the latest version of the image | |
docker pull localstack/localstack | |
# Start LocalStack in the background | |
SERVICES=s3 localstack start -d | |
# Wait 30 seconds for the LocalStack container to become ready before timing out | |
echo "Waiting for LocalStack startup..." | |
localstack wait -t 30 | |
echo "LocalStack Startup complete" | |
awslocal s3api create-bucket --bucket fm-sbt-s3-resolver-example-bucket | |
# This will publishLocal for all crossSbtVersions then test example apps | |
# using the matrix.sbt version. For example we will publish the 0.13 and | |
# 1.0 compatible versions of the plugin (via our configured | |
# crossSbtVersions) and then test using a wider range of SBT versions. | |
- run: sbt -v ^publishLocal ^^${{ matrix.sbt }} scripted | |
if: ${{ github.event_name == 'pull_request' }} | |
env: | |
# LocalStack Notes: | |
# - Seems to want Path Style Access (which is deprecated in AWS S3) | |
# - Seems to want the service endpoint to contain the bucket name (even with path style access) | |
AWS_ACCESS_KEY_ID: test | |
AWS_SECRET_KEY: test | |
S3_PATH_STYLE_ACCESS: true | |
S3_SERVICE_ENDPOINT: http://fm-sbt-s3-resolver-example-bucket.s3.us-west-2.localhost.localstack.cloud:4566 | |
S3_SIGNING_REGION: us-west-2 |