Skip to content

Commit

Permalink
Adds initial version of spec (#1)
Browse files Browse the repository at this point in the history
* adds Makefile

* adds GHA Workflows

* adds API spec

* adds movement plan
  • Loading branch information
ksatirli authored Sep 6, 2024
1 parent 35e6a1a commit 88ec10a
Show file tree
Hide file tree
Showing 15 changed files with 2,011 additions and 25 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/redocly-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---

name: "Redocly: Documentation"

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- adds-spec

env:
REDOCLY_CONFIG: ".redocly.yml"
REDOCLY_FORMAT: "github-actions"
REDOCLY_OUTPUT: "dist/"

jobs:
github-pages:
name: GitHub Pages

# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-pages"
cancel-in-progress: true

# # Deploy to the github-pages environment
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}

permissions:
contents: read
pages: write
id-token: write

runs-on: ubuntu-latest

strategy:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
matrix:
# TODO: make this a more global setting
targets:
- "./mobility-platform"

timeout-minutes: 5

steps:
- name: Checkout Repository
uses: actions/checkout@v4

# see https://github.com/actions/configure-pages
- name: Setup GitHub Pages
uses: actions/configure-pages@v5

# see https://github.com/marketplace/actions/redocly-cli-github-action
- name: Lint OAS file for target `${{ matrix.targets }}`
uses: fluximus-prime/redocly-cli-github-action@v1
with:
args: "lint --config='${{ env.REDOCLY_CONFIG }}' --format='${{ env.REDOCLY_FORMAT }}' '${{ matrix.targets }}/openapi.yml'"

# see https://github.com/marketplace/actions/redocly-cli-github-action
- name: Build Redocly Docs for target `${{ matrix.targets }}`
uses: fluximus-prime/redocly-cli-github-action@v1
with:
args: "build-docs --config='${{ env.REDOCLY_CONFIG }}' --disableGoogleFont --output='${{ env.REDOCLY_OUTPUT }}/${{ matrix.targets }}' '${{ matrix.targets }}/openapi.yml'"

# # see https://github.com/actions/upload-pages-artifact
# - name: Upload artifacts for target `${{ matrix.targets }}`
# uses: actions/upload-pages-artifact@v3
# with:
# path: "${{ env.REDOCLY_OUTPUT }}/${{ matrix.targets }}"
#
# # see https://github.com/actions/deploy-pages
# - name: Deploy to GitHub Pages
# uses: actions/deploy-pages@v4
36 changes: 36 additions & 0 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

name: "Code Quality: Super-Linter"

on: # yamllint disable-line rule:truthy
push:

jobs:
superlinter:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

name: Super-Linter

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
# Super-Linter needs full git history
fetch-depth: 0

- name: Lint Code with Super-Linter
uses: super-linter/super-linter/slim@v6
env:
DEFAULT_BRANCH: main
DISABLE_ERRORS: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true
VALIDATE_MD: true
VALIDATE_OPENAPI: true
VALIDATE_YML: true
172 changes: 172 additions & 0 deletions .github/workflows/terraform-provider-generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
---

name: "Terraform: Provider Generator"

on: # yamllint disable-line rule:truthy
push:
# branches:
# - main

env:
CACHE_KEY: "${{ github.repository }}-${{ github.ref }}"
CACHE_PATHS: |
~/.cache/go-build
/go/bin
/home/runner/go/bin/
GO_VERSION: 1.23

OPENAPI_GENERATOR_CONFIG: generator_config.yml
OPENAPI_GENERATOR_INPUT: openapi.yml
OPENAPI_GENERATOR_OUTPUT: provider_code_spec.json

jobs:
install-binaries:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: false

name: install-binaries
runs-on: ubuntu-latest

strategy:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
matrix:
tools:
- binary: tfplugingen-framework
repository: "github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework@latest"
- binary: tfplugingen-openapi
repository: "github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@latest"

timeout-minutes: 5

steps:
# see https://github.com/marketplace/actions/checkout
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 1

# see https://github.com/marketplace/actions/setup-go-environment
- name: Setup Go `v${{ env.GO_VERSION }}`
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

# see https://github.com/actions/cache
- name: Restore Cache
uses: actions/cache@v4
with:
key: "${{ env.CACHE_KEY }}"
path: ${{ env.CACHE_PATHS }}

# see https://github.com/actions/cache
- name: Populate Cache
uses: actions/cache@v4
with:
key: "${{ env.CACHE_KEY }}"
path: ${{ env.CACHE_PATHS }}

- name: Install `${{ matrix.tools.binary }}`
run: |
go \
install \
"${{ matrix.tools.repository }}"
- name: Print `${{ matrix.tools.binary }}` version
run: |
${{ matrix.tools.binary }} \
--version
generate-provider:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: false

name: generate-provider
needs: install-binaries
runs-on: ubuntu-latest

strategy:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
matrix:
# TODO: make this a more global setting
targets:
- "./mobility-platform"

timeout-minutes: 5

steps:
# see https://github.com/actions/cache
- name: Restore existing cache
uses: actions/cache@v4
with:
key: "${{ env.CACHE_KEY }}"
path: ${{ env.CACHE_PATHS }}

# TODO:
- name: Render Terraform Provider spec with `tfplugingen-openapi`
run: |
echo tfplugingen-openapi \
generate \
--config "${{ matrix.targets }}${{ env.OPENAPI_GENERATOR_CONFIG }}" \
--output "${{ matrix.targets }}${{ env.OPENAPI_GENERATOR_OUTPUT }}" \
"${{ matrix.targets }}${{ env.OPENAPI_GENERATOR_INPUT }}"
commit-changes:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: false

name: commit-changes
needs: generate-provider

# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
# needed for `git-auto-commit-action` to be able to make changes to the generated output file
contents: write

runs-on: ubuntu-latest

strategy:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
matrix:
# TODO: make this a more global setting
targets:
- "./mobility-platform"

timeout-minutes: 5

steps:
- name: Add updated Output to Repository
run: |
echo "Add updated Output to Repository"
# # see https://github.com/marketplace/actions/git-auto-commit
# - name: Add updated Output to Repository
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_author: "GitHub Actions <github-actions[bot]@users.noreply.github.com>"
# commit_message: automated update of rendered provider specification
# commit_options: "--no-verify --signoff"
# commit_user_email: "github-actions[bot]@users.noreply.github.com"
# commit_user_name: "github-actions[bot]"
#
# create_branch: true
#
# disable_globbing: true
#
# file_pattern: "${{ env.OPENAPI_GENERATOR_OUTPUT }}"
# repository: .
# status_options: "--untracked-files=normal"
#
# skip_dirty_check: false
# skip_fetch: false
# skip_checkout: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Project-specific ###
docs/
dist/
Loading

0 comments on commit 88ec10a

Please sign in to comment.