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

Unfudge the worst of it #270

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c0a6e5f
docs(changeset): Reorganise to use OpenAPI spec and drop serverless
chizmw Oct 9, 2023
ddb4fe7
feat: add /render api via openapi spec
chizmw Oct 9, 2023
048756a
chore: update deploy workflow to be terraform only
chizmw Oct 9, 2023
04719fb
chore: move botfpdf to lambda-src/api-render-pdf/
chizmw Oct 9, 2023
819a168
fix: use poetry --directory in the workflow
chizmw Oct 9, 2023
222944b
chore: get pipeline version of python from pyproject.toml
chizmw Oct 9, 2023
a5cb0d2
chore(deps): bump poetry from 1.4.2 to 1.6.1 in deploy workflow
chizmw Oct 9, 2023
c67c1c5
chore: rename workflow -> .github/workflows/deploy.yml
chizmw Oct 9, 2023
b9f98bd
fix: install poetry before python
chizmw Oct 9, 2023
af0db75
chire: rename workflow -> 'Deploy'
chizmw Oct 9, 2023
3ae3ea6
fix: specify version of lambda module to use
chizmw Oct 9, 2023
5b1ad1a
chore: set terraform required_version to ~> 1.6
chizmw Oct 10, 2023
74286dc
feat: add OPTIONS for /render
chizmw Oct 10, 2023
f5efaac
chore: update lambda handler name
chizmw Oct 11, 2023
4e99ab0
feat: add OPTIONS for / endpoint
chizmw Oct 11, 2023
c5c53d8
fix: use terraform workspace in lambda name and policy SID
chizmw Oct 11, 2023
4f9dc6d
chore: fix/clarify names of api, deployment, and stage
chizmw Oct 20, 2023
85337e9
deps: poetry update
chizmw Oct 20, 2023
d956d86
deps: poetry add cffi
chizmw Oct 20, 2023
283b7ca
chore: poetry lock
chizmw Oct 20, 2023
f7c6728
chore: pre-commit autoupdate
chizmw Feb 11, 2024
f111e8d
wip: who knows what; such a mess now
chizmw Feb 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ current_version = 0.3.5

[bumpversion:file:README.md]

[bumpversion:file:pyproject.toml]
[bumpversion:file:lambda-src/api-render-pdf/pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
5 changes: 5 additions & 0 deletions .changeset/wise-files-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'arcane-scripts': minor
---

Reorganise to use OpenAPI spec and drop serverless
129 changes: 129 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
name: Deploy

# https://github.com/hashicorp/setup-terraform#setup-terraform

# yamllint disable-line rule:truthy
on:
pull_request:
branches: [main]
# only if we've changed terraform/ or botcpdf/ directories
paths:
- botcpdf/**
- data/**
- icons/**
- templates/**
- terraform/**
- www/**
push:
tags:
- '*'

# only allow one workflow to run at a time
concurrency:
group: terraform-matrix
cancel-in-progress: false

permissions:
id-token: write
contents: read
issues: write
pull-requests: write

# set default (empty) env vars (keeps liter happy in IDE)
env:
WORKSPACE: ''
DEPLOY_ENV: ''

jobs:
terraform-matrix:
name: Terraform Matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
aws-account-id:
- 436158765452
session-tag:
- botc-json2pdf
include:
- account-name-prefix: chizography
aws-account-id: 436158765452
aws-deployment-role: botc/deploy_json2pdf
aws-region: eu-west-2
terraform-dir: terraform

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set Workspace Env
# if we're a PR then we user 'dev', otherwise we use 'prod'
# https://support.hashicorp.com/hc/en-us/articles/360043550953-Selecting-a-workspace-when-running-Terraform-in-automation
run: |
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
echo "WORKSPACE=dev" >> "$GITHUB_ENV"
else
echo "WORKSPACE=prod" >> "$GITHUB_ENV"
fi

# because we know some of our terraform has an external poetry data
# source, we need to install poetry

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.6.1

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version-file: lambda-src/api-render-pdf/pyproject.toml
cache: poetry

- name: Prerelease Version
shell: bash
if: github.event_name == 'pull_request'
run: |
# for convenience we bump the version number (prerelease) if we're a
# PR; we don't care about keeping this, we just _never_ want to have
# a PR with a normal release version number
poetry --directory=lambda-src/api-render-pdf/ version prerelease

- name: Run Tests
shell: bash
run: |
make test

- name: Run terraform actions
id: run-terraform-actions
# yamllint disable-line rule:line-length
uses: chizmw/[email protected]
with:
# yamllint disable rule:line-length
use-workspaces: true
workspace: ${{ env.WORKSPACE }}
terraform-dir: ${{ matrix.terraform-dir }}
# state-key: ${{ github.repository }}-${{ matrix.aws-account-id }}-${{ matrix.session-tag }}.tfstate
aws-account-id: ${{ matrix.aws-account-id }}
aws-account-name-prefix: ${{ matrix.account-name-prefix }}
aws-session-tag: ${{ matrix.session-tag }}
aws-access-key-id: ${{ secrets.CHIZOGRAPHY_GITHUB_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CHIZOGRAPHY_GITHUB_AWS_SECRET_ACCESS_KEY }}
aws-deployment-role: ${{ matrix.aws-deployment-role }}
github-token: ${{ secrets.GITHUB_TOKEN }}
aws-region: ${{ matrix.aws-region }}
# if we're in a PR or a tag push, set auto-apply to true
auto-apply: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
# yamllint enable rule:line-length

- name: Notify Discord
uses: th0th/[email protected]
if: ${{ always() }}
env:
# yamllint disable rule:line-length
DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/1099136707108020305/r86TwsFW_T3BDX0VOvdcCNVFaGTLTSeVkwS8NikvynVrU-4jZLqq--FlyPVGAmQWJWu9
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_JOB_NAME: Deploy Serverless (${{ env.DEPLOY_ENV }})
GITHUB_JOB_STATUS: ${{ job.status }}
248 changes: 0 additions & 248 deletions .github/workflows/terraform-serverless-deploy.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,5 @@ terraform/poetry-version.json
templates/generated.css
.envrc
test-results.xml
generated.css
builds/
Loading