Skip to content

--- (#2212)

--- (#2212) #4726

Workflow file for this run

name: CI
on:
push:
branches: master
pull_request:
branches: master
merge_group:
jobs:
build_n_test:
name: 'Build & Test core and SBT plugins'
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Set up JDK 1.8'
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: 'Coursier cache'
uses: coursier/cache-action@v5
with:
extraKey: ${{ runner.os }}-coursier-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: 'Compile'
run: 'sbt -J-Dscalafix.disable=true test:compile'
- name: 'Check code quality' # TODO: Separate job
run: |
sbt ';warn ;scalafixAll -check ;scalafmtCheckAll'
- name: 'Run core tests'
run: sbt +core/testOnly
# TODO: core/target/test-reports/TEST-*.xml
- name: 'Run idtl tests'
run: sbt +idtlt/testOnly
# TODO: core/target/test-reports/TEST-*.xml
- name: 'Run python tests'
run: sbt +python/testOnly
# TODO: core/target/test-reports/TEST-*.xml
- name: 'Run SBT plugin tests'
run: |
sbt -J-Dscala-ts.sbt-test-temp=/tmp/sbt-scala-ts/ ';error ;+publishLocal ;++2.12 ;^scripted'
- name: 'Persist generated data'
uses: actions/upload-artifact@v3
with:
name: tmp-generated
path: /tmp/sbt-scala-ts/
typescript:
name: 'Validate TypeScript code generation'
runs-on: ubuntu-latest
needs: build_n_test
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: tmp-generated
path: /tmp/sbt-scala-ts
- name: 'Set up Node'
uses: actions/setup-node@v1
with:
node-version: '18'
- name: 'Compile TypeScript generated from SBT scripted tests'
run: |
cp sbt-plugin/src/node/*.* /tmp/sbt-scala-ts/
cd /tmp/sbt-scala-ts/
find . -type f -name '*.ts' -print
npm ci
npm run build
- name: 'Run TypeScript tests'
run: |
cd /tmp/sbt-scala-ts/
npm run test
export TD="$OLDPWD/sbt-plugin/target"
test -d "$TD" || mkdir -p "$TD"
cp junit.xml "$TD/junit.xml"
python:
name: 'Validate Python code generation'
runs-on: ubuntu-latest
needs: build_n_test
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: tmp-generated
path: /tmp/sbt-scala-ts
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: 'Check Python generated from SBT scripted tests'
run: |
export TD=/tmp/sbt-scala-ts/sbt-plugin-test-python-full/target/scala-ts
cp sbt-plugin-python/src/sbt-test/Pipfile "$TD/Pipfile"
cp sbt-plugin-python/src/sbt-test/sbt-scala-ts-python/full/src/test/resources/setup.py "$TD/setup.py"
cd "$TD"
which pipenv || pip install pipenv
pipenv install --dev
python generated/*.py
pipenv run flake8 --ignore=E501 generated/
pipenv run mypy --namespace-packages --explicit-package-bases generated/
- name: 'Run Python tests'
run: |
export TD=/tmp/sbt-scala-ts/sbt-plugin-test-python-full/target/scala-ts
cp -R sbt-plugin-python/src/sbt-test/sbt-scala-ts-python/full/src/test/python "$TD/tests"
cd "$TD"
pipenv run mypy --namespace-packages --explicit-package-bases tests/*.py
pipenv run python -m pytest tests/*.py
publish:
name: 'Publish artifacts'
runs-on: ubuntu-latest
needs: [typescript, python]
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Publish snapshot (master)'
if: ${{ github.ref == 'refs/heads/master' }}
env:
PUBLISH_REPO_ID: "oss.sonatype.org"
PUBLISH_REPO_URL: "https://oss.sonatype.org/content/repositories/snapshots"
PUBLISH_REPO_NAME: "Sonatype Nexus Repository Manager"
PUBLISH_USER: ${{ secrets.SONATYPE_USER }}
PUBLISH_PASS: ${{ secrets.SONATYPE_PASSWORD }}
run: sbt ';error ;+core/publish ;idtlt/publish ;^sbt-plugin/publish ;^sbt-plugin-idtlt/publish'