From 759eb05ed3c458028f2812680efd6b888c04373a Mon Sep 17 00:00:00 2001 From: Thomas Poignant Date: Sun, 19 Mar 2023 11:32:47 +0100 Subject: [PATCH] Better documentation for CI (#572) Signed-off-by: Thomas Poignant --- website/docs/{linter.md => linter.mdx} | 55 +++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) rename website/docs/{linter.md => linter.mdx} (52%) diff --git a/website/docs/linter.md b/website/docs/linter.mdx similarity index 52% rename from website/docs/linter.md rename to website/docs/linter.mdx index d5f73d9fbcf..e92b29a0c86 100644 --- a/website/docs/linter.md +++ b/website/docs/linter.mdx @@ -2,6 +2,9 @@ sidebar_position: 91 description: Lint your config --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import styles from '../blog/2023-02-20-lint-your-feature-flags/styles.module.css'; # Lint your config @@ -46,11 +49,24 @@ The command line has 2 arguments you should specify. | `--input-file` | **(mandatory)** The location of your configuration file. | | `--input-format` | **(mandatory)** The format of your current configuration file.
Available formats are `yaml`, `json`, `toml`. | -## GitHub Actions +## Use the linter in your CI (continuous integration) + + You can run `go-feature-flag-lint` using GitHub actions: + + + ```yaml +name: "Build" +on: + push: + branches: + - main + pull_request: + types: [ opened, synchronize, reopened ] + jobs: lint: runs-on: ubuntu-latest @@ -60,3 +76,40 @@ jobs: with: args: --input-file=/github/workspace/path/to/your/config.yaml --input-format=yaml ``` + + + + +```yaml +version: 2.1 +jobs: + build: + docker: + - image: cimg/base:2022.05 + + steps: + - checkout + - run: curl -L $(curl -s https://api.github.com/repos/thomaspoignant/go-feature-flag/releases/latest | jq -r '.assets[] | select(.name|match("Linux_x86_64.tar.gz$")) | .browser_download_url' | grep 'go-feature-flag-lint') --output release.tar.gz && tar -zxvf release.tar.gz + - run: ./go-feature-flag-lint --input-format=yaml --input-file=flag-config.yaml # please put the right file name +``` + + + + +```yaml +image: ubuntu +lint-job: + stage: build + + before_script: + - apt-get -qq update + - apt-get install -y jq curl + + script: + - curl -L $(curl -s https://api.github.com/repos/thomaspoignant/go-feature-flag/releases/latest | jq -r '.assets[] | select(.name|match("Linux_x86_64.tar.gz$")) | .browser_download_url' | grep 'go-feature-flag-lint') --output release.tar.gz && tar -zxvf release.tar.gz + - ./go-feature-flag-lint --input-format=yaml --input-file=flag-config.yaml # please put the right file name +``` + + + +