Skip to content

Merge pull request #57 from narrative-io/samidalouche/sc-34116/images… #154

Merge pull request #57 from narrative-io/samidalouche/sc-34116/images…

Merge pull request #57 from narrative-io/samidalouche/sc-34116/images… #154

Workflow file for this run

name: Continuous Integration
on:
pull_request:
branches:
- '**'
push:
branches:
- main
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: Lint, Build, and Test
strategy:
matrix:
os: [self-hosted]
scala: [2.12.18]
java: ["temurin:1.20.0.2"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: SBT Cache
uses: coursier/cache-action@v6
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: ${{ matrix.java }}
apps: sbt sbtn
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
role-to-assume: 'arn:aws:iam::704349335716:role/nio-github-action-runner'
- name: Check formatting
working-directory: backend
run: 'sbt ++${{ matrix.scala }} scalafmtSbtCheck scalafmtCheckAll'
- name: Build project
working-directory: backend
run: 'sbt ++${{ matrix.scala }} test'
- name: Compress target directories
run: tar cf targets.tar backend/*/target
- name: Generate artifact name
uses: mad9000/actions-find-and-replace-string@3
id: artifactname
with:
source: targets-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
find: ':'
replace: '_'
- name: Upload target directories
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifactname.outputs.value }}
path: targets.tar
changeset:
name: Determine Changesets
runs-on: [self-hosted]
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: backend changeset
id: backend
uses: tj-actions/changed-files@v41
with:
files: |
backend/**
outputs:
backend: ${{ steps.backend.outputs.any_changed }}
publish:
name: Publish Artifacts
needs: [build, changeset]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [self-hosted]
scala: [2.12.18]
java: ["temurin:1.20.0.2"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: SBT Cache
uses: coursier/cache-action@v6
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: ${{ matrix.java }}
apps: sbt sbtn
- name: Generate artifact name
uses: mad9000/actions-find-and-replace-string@3
id: artifactname
with:
source: targets-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
find: ':'
replace: '_'
- name: Download target directories (${{ matrix.scala }})
uses: actions/download-artifact@v3
with:
name: ${{ steps.artifactname.outputs.value }}
- name: Inflate target directories (${{ matrix.scala }})
run: |
tar xf targets.tar
rm targets.tar
- name: Publish backend
if: needs.changeset.outputs.backend == 'true'
working-directory: backend
run: sbt "release with-defaults skip-tests"
- name: Prune docker images
run: docker system prune --force --all