chore: transfer code ownership (#65) #26
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
name: Run CI | |
on: | |
push: | |
branches: | |
- main | |
- 'feat/**' | |
paths-ignore: | |
- '**.md' # Do not need to run CI for markdown changes. | |
pull_request: | |
branches: | |
- main | |
- 'feat/**' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
ci-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # If you only need the current version keep this. | |
- uses: actions/setup-python@v3 | |
- uses: actions/setup-node@v3 | |
- run: npm ci | |
- name: Check build and formatting | |
uses: pre-commit/action@v3.0.0 | |
# | |
# Flag variation tests | |
# | |
flag-variations: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
context-key: context-key | |
flags: | | |
test-string-flag, default | |
test-number-flag, -1 | |
test-boolean-flag, false | |
test-json-flag, {} | |
- name: Fail if string value is incorrect | |
if: steps.flags.outputs.test-string-flag != 'custom' | |
run: exit 1 | |
- name: Fail if numeric value is incorrect | |
if: fromJSON(steps.flags.outputs.test-number-flag) != 1 | |
run: exit 1 | |
- name: Fail if boolean value is incorrect | |
if: fromJSON(steps.flags.outputs.test-boolean-flag) != true | |
run: exit 1 | |
- name: Fail if JSON value is incorrect | |
if: fromJSON(steps.flags.outputs.test-json-flag).pet != 'cat' | |
run: exit 1 | |
offline-mode-uses-defaults: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
context-key: context-key | |
offline: true | |
flags: | | |
test-string-flag, default | |
test-number-flag, -1 | |
test-boolean-flag, false | |
test-json-flag, {"pet": "fish"} | |
- name: Fail if string value is incorrect | |
if: steps.flags.outputs.test-string-flag != 'default' | |
run: exit 1 | |
- name: Fail if numeric value is incorrect | |
if: fromJSON(steps.flags.outputs.test-number-flag) != -1 | |
run: exit 1 | |
- name: Fail if boolean value is incorrect | |
if: fromJSON(steps.flags.outputs.test-boolean-flag) != false | |
run: exit 1 | |
- name: Fail if JSON value is incorrect | |
if: fromJSON(steps.flags.outputs.test-json-flag).pet != 'fish' | |
run: exit 1 | |
# | |
# Context targeting tests | |
# | |
can-target-custom-context: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
context-key: context-key | |
flags: test-string-flag, default | |
- name: Fail if it doesn't match | |
if: steps.flags.outputs.test-string-flag != 'custom' | |
run: exit 1 | |
can-target-custom-context-with-default-key: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
flags: test-string-flag, default | |
- name: Fail if it doesn't match | |
if: steps.flags.outputs.test-string-flag != 'custom' | |
run: exit 1 | |
can-target-custom-context-with-custom-attribute: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
context-key: non-matching-key | |
flags: test-string-flag, default | |
env: | |
LD_group: beta | |
- name: Fail if it doesn't match | |
if: steps.flags.outputs.test-string-flag != 'custom' | |
run: exit 1 | |
can-target-runner: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
flags: test-string-flag, default | |
context-key: non-matching-key | |
env: | |
RUNNER_TAG: GitHub Actions | |
- name: Fail if it doesn't match | |
if: steps.flags.outputs.test-string-flag != 'runner' | |
run: exit 1 | |
can-target-github-envs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Evaluate flags | |
id: flags | |
uses: ./ | |
with: | |
stream-uri: 'https://stream.ld.catamorphic.com' | |
events-uri: 'https://events.ld.catamorphic.com' | |
base-uri: 'https://app.ld.catamorphic.com' | |
sdk-key: ${{ secrets.SDK_KEY }} | |
flags: test-string-flag, default | |
context-key: non-matching-key | |
env: | |
RUNNER_TAG: non-matching-tag | |
- name: Fail if it doesn't match | |
if: steps.flags.outputs.test-string-flag != 'github' | |
run: exit 1 |