Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm mage #29

Merged
merged 11 commits into from
Jun 25, 2024
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
157 changes: 123 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,151 @@ on:

env:
VAULT_ADDR: https://vault.eng.aserto.com/
GO_VERSION: "1.22"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Info
-
name: Read configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "USERNAME" | GH_USERNAME;
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN;
kv/data/buf.build "ASERTO_BUF_USER" | BUF_USER;
kv/data/buf.build "ASERTO_BUF_TOKEN" | BUF_TOKEN;
kv/data/MavenCentral "USERNAME" | MAVEN_USERNAME;
kv/data/MavenCentral "PASSWORD" | MAVEN_CENTRAL_TOKEN;
kv/data/MavenCentral "GPG_PASSPHRASE" | MAVEN_GPG_PASSPHRASE;
kv/data/MavenCentral "PRIVATE_GPG_KEY" | MAVEN_GPG_PRIVATE_KEY;
kv/data/MavenCentral "TOKEN_USERNAME" | TOKEN_USERNAME;
kv/data/MavenCentral "TOKEN_PASSWORD" | TOKEN_PASSWORD;
-
name: Info
run: echo "Using proto ${{ github.event.inputs.proto_ref }} with sha ${{ github.event.inputs.proto_sha }}"

- name: Checkout
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Install dependencies, update proto and build
run: |
go run mage.go all

- name: Commit changes
-
name: Install deps
run: make deps
-
name: Clean Generated Code
run: make clean-gen
-
name: Generate Code
run: make buf-generate
-
name: Build
run: make build
-
name: Commit changes
if: github.event_name == 'workflow_dispatch'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
add: 'pom.xml src'
push: origin HEAD:main
release:

test:
runs-on: ubuntu-latest
needs: build
steps:
-
name: Read configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "USERNAME" | GH_USERNAME;
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN;
kv/data/buf.build "ASERTO_BUF_USER" | BUF_USER;
kv/data/buf.build "ASERTO_BUF_TOKEN" | BUF_TOKEN;
kv/data/MavenCentral "USERNAME" | MAVEN_USERNAME;
kv/data/MavenCentral "PASSWORD" | MAVEN_CENTRAL_TOKEN;
kv/data/MavenCentral "GPG_PASSPHRASE" | MAVEN_GPG_PASSPHRASE;
kv/data/MavenCentral "PRIVATE_GPG_KEY" | MAVEN_GPG_PRIVATE_KEY;
kv/data/MavenCentral "TOKEN_USERNAME" | TOKEN_USERNAME;
kv/data/MavenCentral "TOKEN_PASSWORD" | TOKEN_PASSWORD;
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
-
name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ env.MAVEN_GPG_PRIVATE_KEY }}
passphrase: MAVEN_GPG_PASSPHRASE
-
name: Install deps
run: make deps
-
name: Install package
run: make install
-
name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
-
name: Install topaz
run: brew tap aserto-dev/tap && brew install aserto-dev/tap/topaz && topaz install && topaz templates install todo --no-console --force
-
name: Build examples
working-directory: examples
run: mvn --no-transfer-progress clean package
-
name: Run examples
working-directory: examples
run: |
cp assets/.env.topaz-directory.example .env
java -jar target/examples-1.0.0-SNAPSHOT-shaded.jar

release:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: Release to maven central
steps:
- name: Read Configuration
-
name: Read configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "USERNAME" | GH_USERNAME;
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN;
kv/data/buf.build "ASERTO_BUF_USER" | BUF_USER;
kv/data/buf.build "ASERTO_BUF_TOKEN" | BUF_TOKEN;
kv/data/MavenCentral "USERNAME" | MAVEN_USERNAME;
kv/data/MavenCentral "PASSWORD" | MAVEN_CENTRAL_TOKEN;
kv/data/MavenCentral "GPG_PASSPHRASE" | MAVEN_GPG_PASSPHRASE;
kv/data/MavenCentral "PRIVATE_GPG_KEY" | MAVEN_GPG_PRIVATE_KEY;
kv/data/MavenCentral "TOKEN_USERNAME" | TOKEN_USERNAME;
kv/data/MavenCentral "TOKEN_PASSWORD" | TOKEN_PASSWORD;

- name: Checkout
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java for publishing to Maven Central Repository
-
name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 8
Expand All @@ -83,24 +172,24 @@ jobs:
server-password: TOKEN_PASSWORD
gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: build artifact
run: mvn --no-transfer-progress clean package

- name: Create release
-
name: Build
run: make build
-
name: Create release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "${{ github.workspace }}/target/*.jar"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to the Maven Central Repository
run: mvn --no-transfer-progress --batch-mode deploy

- name: Bump to the next version
run: go run mage.go bump patch

- name: Commit changes
-
name: Publish to the Maven Central Repository
run: make deploy
-
name: Bump to the next version
run: make bump
-
name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/gitleaks-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: gitleaks-check

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: gitleaks-check
uses: aserto-dev/gitleaks-action@master
8 changes: 0 additions & 8 deletions Depfile

This file was deleted.

28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,37 @@

[![slack](https://img.shields.io/badge/slack-Aserto%20Community-brightgreen)](https://asertocommunity.slack.com)

Java GRPC bindings for aserto directory. Those are raw bindings, for a better developer experience we recommend you use [aserto-java](https://github.com/aserto-dev/aserto-java) or [aserto-spring](https://github.com/aserto-dev/aserto-spring) if your project already uses Spring.
Generated Java gRPC bindings for the Topaz and Aserto Directory Service; these are low-level bindings.
For a more idiomatic Java development experience, we advise using the [aserto-java](https://github.com/aserto-dev/aserto-java) or [aserto-spring](https://github.com/aserto-dev/aserto-spring) when your project is using Spring.


## Requirements
- [buf cli](https://docs.buf.build/installation)
- GNU make
- [maven](https://maven.apache.org/guides/introduction/introduction-to-the-pom.html)
- java 1.8 or newer
- Java 8 or newer

If you need to regenerate the protobuf binding you will also need the:
- [buf cli](https://docs.buf.build/installation), which will be installed by using `make deps`

### Building the project
```bash
mvn clean && mvn package
make build
```

or

```bash
mvn clean package
```

If you want to install the package to your local maven repository in order to include it in other projects

```bash
make install
```

or

```bash
mvn clean && mvn install
mvn clean install
```
20 changes: 20 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: v1

deps:
- buf.build/aserto-dev/aserto

lint:
use:
- DEFAULT
except:
- PACKAGE_DIRECTORY_MATCH
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
enum_zero_value_suffix: _UNKNOWN

breaking:
use:
- FILE
- PACKAGE
- WIRE
- WIRE_JSON
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd examples
To build the example package, execute:

```
mvn clean && mvn package
mvn clean package
```

## 2. setup environment
Expand Down
5 changes: 0 additions & 5 deletions go.mod

This file was deleted.

2 changes: 0 additions & 2 deletions go.sum

This file was deleted.

12 changes: 0 additions & 12 deletions mage.go

This file was deleted.

51 changes: 0 additions & 51 deletions magefiles/go.mod

This file was deleted.

Loading