Skip to content

Commit

Permalink
Merge pull request #83 from dictyBase/feat/command-line-without-datab…
Browse files Browse the repository at this point in the history
…ase-name

Pulling feat/command-line-without-database-name into develop
  • Loading branch information
kodiakhq[bot] authored Aug 3, 2023
2 parents 790e4ba + e8d4e55 commit b010c2a
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 30 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ on:
- develop
jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
services:
arangodb:
image: arangodb:3.8.7
image: arangodb:3.10.9
env:
ARANGO_ROOT_PASSWORD: rootpass
ports:
- 8529/tcp
steps:
- name: set up golang
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: check out code
uses: actions/checkout@v3
- name: set up golang
uses: actions/setup-go@v4
with:
go-version: '~1.20.6'
- name: unit test
run: go test -covermode=atomic -coverprofile=profile.cov -cpu 4 -v ./...
env:
Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/create-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
name: Create Pull Request
on: create
jobs:
create-pr:
runs-on: ubuntu-20.04
if: github.actor != 'dependabot[bot]'
create-pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get branch name
id: vars
- name: Checkout code
uses: actions/checkout@v3
- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
run: |
branch=$(echo ${{ github.ref }} | sed -r 's/refs\/heads\///')
echo ::set-output name=branch::${branch}
- name: pull-request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_branch: develop
pr_title: Pulling ${{ steps.vars.outputs.branch }} into develop
# Get current branch name
branch_name=$(git symbolic-ref --short HEAD)
# Create pull request using GitHub CLI
gh pr create --base develop --title "Auto-generated Pull Request for $branch_name" --body "Pulling '$branch_name into develop. Please review and merge."
18 changes: 8 additions & 10 deletions .github/workflows/testcov.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
name: Test coverage
on:
pull_request:
types: [edited, labeled, opened, synchronize, reopened]
on: [pull_request]
jobs:
test:
name: Unit tests
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
services:
arangodb:
image: arangodb:3.8.7
image: arangodb:3.10.9
env:
ARANGO_ROOT_PASSWORD: rootpass
ports:
- 8529/tcp
steps:
- name: set up golang
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '~1.20.6'
- run: go version
- name: check out code
uses: actions/checkout@v3
- name: unit test
run: go test -covermode=atomic -coverprofile=profile.cov -cpu 4 -v ./...
run: go test -covermode=atomic -coverprofile=profile.cov -v ./...
env:
GOPROXY: https://proxy.golang.org
ARANGO_USER: root
ARANGO_PASS: rootpass
ARANGO_HOST: localhost
ARANGO_PORT: ${{ job.services.arangodb.ports[8529] }}
GOPROXY: https://proxy.golang.org
- name: upload coverage to codecov
uses: codecov/codecov-action@v3
with:
Expand Down
66 changes: 66 additions & 0 deletions command/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,72 @@ import (
"github.com/urfave/cli"
)

/*
The ArangoFlags function returns a []cli.Flag containing the following flags:
- arangodb-pass: The password for the ArangoDB database.
This flag is required and can be set using the ARANGODB_PASS environment variable.
- arangodb-user: The user for the ArangoDB database.
This flag is required and can be set using the ARANGODB_USER environment variable.
- arangodb-host: The host for the ArangoDB database.
The default value is "arangodb" and can be overridden using the ARANGODB_SERVICE_HOST
environment variable. This flag is required.
- arangodb-port: The port for the ArangoDB database.
The default value is "8529" and can be overridden using the ARANGODB_SERVICE_PORT environment variable.
- is-secure: A boolean flag indicating whether the ArangoDB endpoint is secured or unsecured.
Example usage:
flags := ArangoFlags()
app := cli.NewApp()
app.Flags = flags
...
err := app.Run(os.Args)
The ArangoFlags function can be used in a command-line application to easily configure ArangoDB connection details.
*/
func ArangoFlags() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "arangodb-pass, pass",
EnvVar: "ARANGODB_PASS",
Usage: "arangodb database password",
Required: true,
},
cli.StringFlag{
Name: "arangodb-user, user",
EnvVar: "ARANGODB_USER",
Usage: "arangodb database user",
Required: true,
},
cli.StringFlag{
Name: "arangodb-host, host",
Value: "arangodb",
EnvVar: "ARANGODB_SERVICE_HOST",
Usage: "arangodb database host",
Required: true,
},
cli.StringFlag{
Name: "arangodb-port",
EnvVar: "ARANGODB_SERVICE_PORT",
Usage: "arangodb database port",
Value: "8529",
},
cli.BoolFlag{
Name: "is-secure",
Usage: "flag for secured or unsecured arangodb endpoint",
},
}
}

// ArangodbFlags returns the cli based flag slice that includes
// command line arguments for connecting to an arangodb instance.
func ArangodbFlags() []cli.Flag {
Expand Down

0 comments on commit b010c2a

Please sign in to comment.