Skip to content

Commit

Permalink
enhancement(dev): Add dedicated helper tool (#15833)
Browse files Browse the repository at this point in the history
* Add dedicated dev tool

* refactor

* Apply suggestions from code review

Co-authored-by: neuronull <kyle.criddle@datadoghq.com>

* address

* add env management commands

* add test command

* refactor with once_cell

* refactor sub-process handling

* improve error messages

* handle case of first time user

* reduce boilerplate with macros

* address

* Apply suggestions from code review

Co-authored-by: Stephen Wakely <stephen@lisp.space>

* address

* add top-level test command

* add to CI

* Apply suggestions from code review

Co-authored-by: Stephen Wakely <stephen@lisp.space>

* final update

* Fix clippy lints

* Convert extensions to `process::Command` into an extension trait

* Add `infer_subcommands` option and unabbreviate `int` subcommand

* address

* Flatten out the `cli.rs` files

* Inline the used cfg options

* Drop unused config bits

* Turn on `clippy::pedantic` and fix issues

* Pass command args owned to allow for direct use

* Eliminate some silent error fallbacks

* Simplify logic of `integration show`

* Drop some common parameters in testing functions

* Fix new clippy lints

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
Co-authored-by: neuronull <kyle.criddle@datadoghq.com>
Co-authored-by: Stephen Wakely <stephen@lisp.space>
  • Loading branch information
4 people authored Jan 9, 2023
1 parent 9648080 commit 3694010
Show file tree
Hide file tree
Showing 33 changed files with 2,578 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/actions/install-vdev/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Install vdev

inputs:
token:
required: true

runs:
using: composite

steps:
# default 2.x fails
- if: runner.os == 'Windows'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'

- name: Wait for build
uses: lewagon/wait-on-check-action@v1.2.0
with:
repo-token: ${{ inputs.token }}
check-name: Build executable for ${{ runner.os }}
ref: ${{ github.sha }}
wait-interval: 20

- name: Try downloading current artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ inputs.token }}
workflow: build-vdev.yml
branch: ${{ github.ref_name }}
name: vdev-${{ runner.os }}
path: vdev/bin

- if: github.event_name == 'pull_request' && failure()
name: Download latest artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ inputs.token }}
workflow: build-vdev.yml
branch: master
name: vdev-${{ runner.os }}
path: vdev/bin

- name: Add binary to PATH
run: mv vdev/bin/* "$HOME/.cargo/bin"
shell: bash

- if: runner.os != 'Windows'
name: Make binary executable
run: chmod +x "$HOME/.cargo/bin/vdev"
shell: bash
43 changes: 43 additions & 0 deletions .github/workflows/build-vdev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build vdev

on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "vdev/**/*"

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
exe:
# Name must match runner.os https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
name: Build executable for ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v3

- name: Build release binary
run: |
cd vdev
cargo build --release
- if: runner.os != 'Windows'
name: Strip binary
run: strip vdev/target/release/vdev

- uses: actions/upload-artifact@v3
with:
name: vdev-${{ runner.os }}
path: vdev/target/release/${{ runner.os == 'Windows' && 'vdev.exe' || 'vdev' }}
if-no-files-found: error
Loading

0 comments on commit 3694010

Please sign in to comment.