This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from guardian/infra
Initialise an empty GuCDK project
- Loading branch information
Showing
14 changed files
with
8,090 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# 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: | ||
# TODO uncomment these lines | ||
# branches: | ||
# main | ||
|
||
# Ensure we only ever have one build running at a time. | ||
# If we push twice in quick succession, the first build will be stopped once the second starts. | ||
# This avoids any race conditions. | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
CI: | ||
runs-on: ubuntu-latest | ||
|
||
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token | ||
permissions: | ||
# required by aws-actions/configure-aws-credentials | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
cache-dependency-path: 'cdk/package-lock.json' | ||
|
||
- name: CDK build | ||
working-directory: cdk | ||
run: | | ||
npm ci | ||
npm run lint | ||
npm test | ||
npm run synth | ||
# Setup AWS credentials to enable uploading to S3 for Riff-Raff. | ||
# See https://github.com/aws-actions/configure-aws-credentials | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | ||
aws-region: eu-west-1 | ||
|
||
# See https://github.com/guardian/actions-riff-raff | ||
- name: Upload to riff-raff | ||
uses: guardian/actions-riff-raff@v2 | ||
with: | ||
projectName: interactives::interactive-tilemaker | ||
configPath: cdk/cdk.out/riff-raff.yaml # Generated by https://github.com/guardian/cdk/tree/main/src/experimental/riff-raff-yaml-file | ||
contentDirectories: | | ||
cdk.out: | ||
- cdk/cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# TODO | ||
- [X] Follow https://github.com/guardian/cdk/blob/main/docs/setting-up-a-gucdk-project.md to create a new GuCDK project | ||
```sh | ||
npx @guardian/cdk@latest new \ | ||
--app riff-raff \ | ||
--stack deploy \ | ||
--stage CODE \ | ||
--stage PROD \ | ||
--package-manager npm | ||
``` | ||
- [x] Setup the project in CI (https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) and CD | ||
- [ ] Run the Dockerfile in AWS (via GuCDK) | ||
- [ ] Profit? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.js | ||
!jest.config.js | ||
!jest.setup.js | ||
!.eslintrc.js | ||
*.d.ts | ||
node_modules | ||
dist | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Infrastructure | ||
|
||
This directory defines the components to be deployed to AWS. | ||
|
||
See [`package.json`](./package.json) for a list of available scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import "source-map-support/register"; | ||
import { GuRootExperimental } from "@guardian/cdk/lib/experimental/constructs/root"; | ||
import { InteractiveTilemaker } from "../lib/interactive-tilemaker"; | ||
|
||
const app = new GuRootExperimental(); | ||
|
||
new InteractiveTilemaker(app, "InteractiveTilemaker-PROD", { stack: "interactives", stage: "PROD", env: { region: 'eu-west-1' } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"app": "npx ts-node bin/cdk.ts", | ||
"context": { | ||
"aws-cdk:enableDiffNoFail": "true", | ||
"@aws-cdk/core:stackRelativeExports": "true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jest.mock("@guardian/cdk/lib/constants/tracking-tag"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The InteractiveTilemaker stack matches the snapshot 1`] = ` | ||
{ | ||
"Metadata": { | ||
"gu:cdk:constructs": [], | ||
"gu:cdk:version": "TEST", | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { App } from "aws-cdk-lib"; | ||
import { Template } from "aws-cdk-lib/assertions"; | ||
import { InteractiveTilemaker } from "./interactive-tilemaker"; | ||
|
||
describe("The InteractiveTilemaker stack", () => { | ||
it("matches the snapshot", () => { | ||
const app = new App(); | ||
const stack = new InteractiveTilemaker(app, "InteractiveTilemaker", { stack: "interactives", stage: "TEST" }); | ||
const template = Template.fromStack(stack); | ||
expect(template.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { join } from "path"; | ||
import type { GuStackProps } from "@guardian/cdk/lib/constructs/core"; | ||
import { GuStack } from "@guardian/cdk/lib/constructs/core"; | ||
import type { App } from "aws-cdk-lib"; | ||
import { CfnInclude } from "aws-cdk-lib/cloudformation-include"; | ||
|
||
export class InteractiveTilemaker extends GuStack { | ||
constructor(scope: App, id: string, props: GuStackProps) { | ||
super(scope, id, props); | ||
} | ||
} |
Oops, something went wrong.