Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 0 additions & 182 deletions .circleci/config.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build & Test
on:
push:
tags:
- '*' # Build for any tag
pull_request:

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: Get tag name, or set default
id: get_version
run: |
# Use the pushed tag, or default to 0.0.1 if no tag
VERSION="${GITHUB_REF#refs/tags/}"

# If no tag was pushed, use default
if [[ "$VERSION" == "$GITHUB_REF" ]]; then
VERSION="0.0.1"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
shell: bash
- name: Generate SHA data
run: |
echo "SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> "$GITHUB_ENV"
echo "SHORT_SHA=$(cut -c 1-7 <<< ${{ github.event.pull_request.head.sha || github.sha }})" >> "$GITHUB_ENV"
- name: Generate code
run: make all
env:
LD_RELEASE_VERSION: ${{ env.VERSION }}
- name: Archive targets
run: |
tar czvf api-clients-${{ env.VERSION }}-${{ env.SHORT_SHA }}.tgz api-client-*
mkdir /tmp/api-clients
cp api-clients-*.tgz /tmp/api-clients/
working-directory: targets

- name: Upload targets directory
uses: actions/upload-artifact@v4
with:
name: targets
path: targets/
- name: Upload API clients
uses: actions/upload-artifact@v4
with:
name: api-clients-${{ env.VERSION }}-${{ env.SHORT_SHA }}
path: /tmp/api-clients
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: html
path: targets/html2
- name: Upload plain HTML
uses: actions/upload-artifact@v4
with:
name: plain-html
path: targets/html

test:
needs: build
uses: './.github/workflows/test.yml'
secrets: inherit
with:
version: ${{ needs.build.outputs.version }}
141 changes: 141 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
on:
workflow_call:
inputs:
version:
required: true
type: string

env:
LD_API_KEY: ${{ secrets.LD_API_TOKEN }}

jobs:
test-go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: |
mkdir -p /home/runner/go/src/github.com/launchdarkly
cp -r targets/api-client-go /home/runner/go/src/github.com/launchdarkly/
- run: make
working-directory: samples/go

test-javascript:
runs-on: ubuntu-latest
if: false # Disable the test for now - it's broken due to ES6 stuff. Other tests confirm the clients are working
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: npm install
working-directory: targets/api-client-javascript
- run: |
npm link $GITHUB_WORKSPACE/targets/api-client-javascript
node --experimental-modules index.js
working-directory: samples/javascript


test-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: |
pip install -e ../../targets/api-client-python
python main.py
working-directory: samples/python

test-ruby:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: |
gem build launchdarkly_api.gemspec
gem install ./launchdarkly_api*.gem
working-directory: targets/api-client-ruby
- run: ruby main.rb
working-directory: samples/ruby

test-java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'corretto'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: mvn clean install
working-directory: targets/api-client-java
- run: | # TODO: Need to fix the tag below
sed -i.bak -e "s/API_CLIENT_VERSION/${{ inputs.version }}/g" pom.xml
mvn clean install
mvn exec:java
working-directory: samples/java

test-typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: |
npm install
npm run build
npm link
working-directory: targets/api-client-typescript-axios
- run: |
npm link launchdarkly-api-typescript
npm install
npm run build
npm start
working-directory: samples/typescript-axios

test-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- uses: actions/download-artifact@v4
with:
name: targets
path: ./targets
- run: |
echo '{"require":{"launchdarkly/api-client-php":"@dev","guzzlehttp/guzzle":"*"},"repositories":[{"type":"path","url":"../../targets/api-client-php","options":{"symlink":true}}]}' > composer.json
composer update
php index.php
working-directory: samples/php
Loading