Skip to content

Commit

Permalink
move to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
twrichards committed Oct 2, 2023
1 parent 9072d1f commit 474d4c2
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 1,671 deletions.
125 changes: 81 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
name: Grid CI
on: [pull_request]
on:
workflow_dispatch: # Manual invocation.
push:
jobs:
JSBuild:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [16.20.0]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Kahuna
working-directory: ./kahuna
run: |
npm ci
npm test
- name: Image Counter Lambda
working-directory: ./image-counter-lambda
run: |
npm ci
npm test
- name: S3Watcher
working-directory: ./s3watcher/lambda
run: |
npm ci
npm run build
#- name: Reaper
# working-directory: ./reaper
# run: |
# npm install
# npm run riffraff-artefact

ScalaBuild:
runs-on: ubuntu-20.04
CI:
runs-on: ubuntu-latest
permissions:
# required by aws-actions/configure-aws-credentials
id-token: write
contents: read
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
Expand All @@ -57,12 +31,75 @@ jobs:
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/[email protected]
- name: SBT
uses: ./.github/actions/sbt
env:
USE_DOCKER_FOR_TESTS: false
ES6_TEST_URL: http://elasticsearch:9200
LOCALSTACK_ENDPOINT: http://localstack:4566
with:
args: clean compile test:compile test
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Kahuna (client-side)
working-directory: ./kahuna
run: |
npm install-clean
npm run undist
npm test
npm run dist
- name: SBT
uses: ./.github/actions/sbt
env:
USE_DOCKER_FOR_TESTS: false
ES6_TEST_URL: http://elasticsearch:9200
LOCALSTACK_ENDPOINT: http://localstack:4566
with:
args: clean compile test:compile test debian:packageBin
- uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1
- name: Image Counter Lambda
working-directory: ./image-counter-lambda
run: |
npm install-clean
npm test
npm run compile
- name: S3Watcher
working-directory: ./s3watcher/lambda
run: |
npm install-clean
npm test
npm run build
- uses: guardian/actions-riff-raff@v2
with:
projectName: media-service::grid::all
buildNumberOffset: 7565
configPath: riff-raff.yaml
contentDirectories: |
auth:
- auth/target/auth.deb
collections:
- collections/target/collections.deb
cropper:
- cropper/target/cropper.deb
image-loader-projection:
- image-loader/target/image-loader.deb
image-loader:
- image-loader/target/image-loader.deb
kahuna:
- kahuna/target/kahuna.deb
leases:
- leases/target/leases.deb
media-api:
- media-api/target/media-api.deb
metadata-editor:
- metadata-editor/target/metadata-editor.deb
thrall:
- thrall/target/thrall.deb
usage:
- usage/target/usage.deb
image-counter-lambda:
- image-counter-lambda/dist/image-counter-lambda.zip
s3watcher:
- s3watcher/lambda/target/s3watcher.zip
35 changes: 11 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import scala.sys.process._
import scala.util.control.NonFatal
import scala.collection.JavaConverters._

import com.typesafe.sbt.packager.debian.JDebPackaging

// We need to keep the timestamps to allow caching headers to work as expected on assets.
// The below should work, but some problem in one of the plugins (possible the play plugin? or sbt-web?) causes
// the option not to be passed correctly
Expand Down Expand Up @@ -41,29 +43,6 @@ lazy val commonProjects: Seq[sbt.ProjectReference] = Seq(commonLib, restLib, aut

lazy val root = project("grid", path = Some("."))
.aggregate((maybeBBCLib.toList ++ commonProjects):_*)
.enablePlugins(RiffRaffArtifact)
.settings(
riffRaffManifestProjectName := s"media-service::grid::all",
riffRaffUploadArtifactBucket := Some("riffraff-artifact"),
riffRaffUploadManifestBucket := Some("riffraff-builds"),
riffRaffArtifactResources := Seq(
(auth / Debian / packageBin).value -> s"${(auth / name).value}/${(auth / name).value}.deb",
(collections / Debian / packageBin).value -> s"${(collections / name).value}/${(collections / name).value}.deb",
(cropper / Debian / packageBin).value -> s"${(cropper / name).value}/${(cropper / name).value}.deb",
(imageLoader / Debian / packageBin).value -> s"${(imageLoader / name).value}/${(imageLoader / name).value}.deb",
// image-loader-projection uses the same deb as image-loader, we're running it for isolation of traffic in batch reindexing
(imageLoader / Debian / packageBin).value -> s"${(imageLoader / name).value}-projection/${(imageLoader / name).value}-projection.deb",
(leases / Debian / packageBin).value -> s"${(leases / name).value}/${(leases / name).value}.deb",
(thrall / Debian / packageBin).value -> s"${(thrall / name).value}/${(thrall / name).value}.deb",
(kahuna / Debian / packageBin).value -> s"${(kahuna / name).value}/${(kahuna / name).value}.deb",
(metadataEditor / Debian / packageBin).value -> s"${(metadataEditor / name).value}/${(metadataEditor / name).value}.deb",
(usage / Debian / packageBin).value -> s"${(usage / name).value}/${(usage / name).value}.deb",
(mediaApi / Debian / packageBin).value -> s"${(mediaApi / name).value}/${(mediaApi / name).value}.deb",
// pull in s3watcher build
file("s3watcher/lambda/target/s3watcher.zip") -> "s3watcher/s3watcher.zip",
file("riff-raff.yaml") -> "riff-raff.yaml",
)
)

addCommandAlias("runAll", "all auth/run media-api/run thrall/run image-loader/run metadata-editor/run kahuna/run collections/run cropper/run usage/run leases/run")
addCommandAlias("runMinimal", "all auth/run media-api/run kahuna/run")
Expand Down Expand Up @@ -245,7 +224,15 @@ def playProject(projectName: String, port: Int, path: Option[String] = None): Pr

bashScriptEnvConfigLocation := Some("/etc/environment"),
Debian / makeEtcDefault := None,

Debian / packageBin := {
val originalFileName = (Debian / packageBin).value
val (base, ext) = originalFileName.baseAndExt
val newBase = base.replace(s"_${version.value}_all","")
val newFileName = file(originalFileName.getParent) / s"$newBase.$ext"
IO.move(originalFileName, newFileName)
println(s"Renamed $originalFileName to $newFileName")
newFileName
},
Universal / mappings ++= Seq(
file("common-lib/src/main/resources/application.conf") -> "conf/application.conf",
file("common-lib/src/main/resources/logback.xml") -> "conf/logback.xml"
Expand Down
16 changes: 0 additions & 16 deletions dev/script/push-pr.sh

This file was deleted.

11 changes: 0 additions & 11 deletions image-counter-lambda/artifact.json

This file was deleted.

Loading

0 comments on commit 474d4c2

Please sign in to comment.