Skip to content

Merge pull request #655 from softwaremill/dependabot/npm_and_yarn/ui/… #1501

Merge pull request #655 from softwaremill/dependabot/npm_and_yarn/ui/…

Merge pull request #655 from softwaremill/dependabot/npm_and_yarn/ui/… #1501

name: Adopt Tapir CI
on:
pull_request:
push:
branches:
- main
paths-ignore:
- "helm/**"
release:
types:
- released
jobs:
verify_unit_tests_lint:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v4
- name: Set up JDK 17 with sbt cache
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'
- name: Check formatting
id: check-formatting
run: sbt scalafmtCheckAll
- name: Run unit tests & lint
id: run-unit-tests
run: sbt test
verify_integration:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
scala: [ "Scala2", "Scala3" ]
json: [ "No", "Circe", "UPickle", "Jsoniter", "ZIOJson", "Pickler" ]
stack: [ "OxStack", "FutureStack", "IOStack", "ZIOStack" ]
exclude:
- scala: "Scala2"
json: "Pickler"
- scala: "Scala2"
stack: "OxStack"
steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v4
- name: Cache scala-cli
uses: coursier/cache-action@v6
- name: Set up scala-cli
uses: VirtusLab/scala-cli-setup@v1
with:
jvm: ${{ matrix.stack == 'OxStack' && 'temurin:21' || 'temurin:17' }}
- name: Run integration tests for ${{ matrix.stack }}, ${{ matrix.scala }} with ${{ matrix.json }} JSON support
run: SCALA=${{ matrix.scala }} JSON=${{ matrix.json }} STACK=${{ matrix.stack }} IT_TESTS_THREADS_NO=1 sbt 'ItTest / test'
verify_docker_image_build:
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main'
needs: [ verify_unit_tests_lint, verify_integration ]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v4
- name: Set up JDK 21 with sbt cache
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'sbt'
- name: Build docker image locally
id: build-docker-image-locally
run: sbt -Dsbt.task.timings=true docker:publishLocal
deploy:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: [ verify_unit_tests_lint, verify_integration ]
runs-on: ubuntu-22.04
steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v4
- name: Set up JDK 21
id: jdk-setup
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'sbt'
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish docker image
run: sbt -Dsbt.task.timings=true backend/docker:publish
# `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a
# whitelist specified by `labeler.yml`
label:
name: Attach automerge label
# only for PRs by softwaremill-ci
if: github.event.pull_request.user.login == 'softwaremill-ci'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
# count number of files changed
- name: Count number of files changed
id: count-changed-files
run: |
N=$(git diff --name-only -r HEAD^1 HEAD | wc -w)
echo "changed_files_num=$N" >> $GITHUB_OUTPUT
- name: Launch labeler
# skip if more than one file changed
if: steps.count-changed-files.outputs.changed_files_num == 1
uses: srvaroa/labeler@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
auto-merge:
name: Auto merge
# only for PRs by softwaremill-ci
if: github.event.pull_request.user.login == 'softwaremill-ci'
needs: [ verify_unit_tests_lint, verify_integration, verify_docker_image_build, label ]
runs-on: ubuntu-22.04
steps:
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_METHOD: "squash"