Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt GitHub Actions for CI #189

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Find full documentation here https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: CI

on:
pull_request:

# Manual invocation.
workflow_dispatch:

push:
branches:
- main
jobs:
CI:
runs-on: ubuntu-latest
permissions:
# required by aws-actions/configure-aws-credentials
id-token: write
contents: read
steps:
- uses: actions/checkout@v3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a v4 of this action.


- uses: aws-actions/configure-aws-credentials@v2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a v4 of this.

with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1

- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: 'package-lock.json'

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'corretto'
Comment on lines +37 to +38

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding cache: 'sbt' here is apparently helpful for performance, I learnt here.


- name: Install Grunt
run: npm install -g grunt-cli

- name: Install JSPM
run: npm install -g jspm@0.16.55

- name: Install NPM dependencies
run: npm ci

- name: JSPM Install
env:
JSPM_GITHUB_AUTH_SECRET: ${{ secrets.GITHUB_TOKEN }}
run: |
jspm config registries.github.auth ${{ secrets.GITHUB_TOKEN }}
jspm config registries.github.remote https://github.jspm.io
jspm config registries.github.handler jspm-github
jspm registry export github
jspm install

- name: Grunt
run: |
grunt --stack validate test
grunt --stack bundle

- name: SBT
run: sbt "clean;compile;test;assets;Debian / packageBin"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note on batch mode, apparently it makes builds run more slowly. Having said that, this discussion suggests that these sbt commands will run in batch mode, and sequentially (i.e. no need for semicolons either), anyway.

I believe you can also remove the space and have Debian/packageBin, to remove the need for quotes.


- uses: guardian/actions-riff-raff@v2
with:
projectName: cms-fronts::story-packages
buildNumberOffset: 700
configPath: riff-raff.yaml
contentDirectories: |
story-packages:
- target/story-packages_1.0.0_all.deb
18 changes: 2 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import com.gu.riffraff.artifact.BuildInfo

import scala.sys.env

name := "story-packages"
Expand All @@ -18,18 +16,6 @@ import sbt.Resolver

debianPackageDependencies := Seq("openjdk-8-jre-headless")

riffRaffPackageName := s"cms-fronts::${name.value}"
riffRaffManifestProjectName := riffRaffPackageName.value
riffRaffPackageType := (Debian / packageBin).value
riffRaffUploadArtifactBucket := Option("riffraff-artifact")
riffRaffUploadManifestBucket := Option("riffraff-builds")
riffRaffArtifactResources := {
Seq(
(Debian / packageBin).value -> s"${name.value}/${name.value}_${version.value}_all.deb",
baseDirectory.value / "riff-raff.yaml" -> "riff-raff.yaml"
)
}

javacOptions := Seq("-g","-encoding", "utf8")

Universal / javaOptions ++= Seq(
Expand Down Expand Up @@ -58,7 +44,7 @@ resolvers ++= Seq(
)

buildInfoPackage := "app"
buildInfoKeys += "gitCommitId" -> BuildInfo(baseDirectory.value).revision
buildInfoKeys += "gitCommitId" -> env.getOrElse("GITHUB_SHA", "Unknown")

lazy val jacksonVersion = "2.13.4"
lazy val jacksonDatabindVersion = "2.13.4.2"
Expand Down Expand Up @@ -100,4 +86,4 @@ libraryDependencies ++= jacksonOverrides ++ Seq(
"org.scalatest" %% "scalatest" % "3.2.15" % "test"
)

lazy val root = (project in file(".")).enablePlugins(PlayScala, RiffRaffArtifact, JDebPackaging, SystemdPlugin, BuildInfoPlugin)
lazy val root = (project in file(".")).enablePlugins(PlayScala, JDebPackaging, SystemdPlugin, BuildInfoPlugin)
2 changes: 0 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ resolvers ++= Seq(

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19")

addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "1.1.12")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
22 changes: 0 additions & 22 deletions scripts/ci.sh

This file was deleted.

Loading