-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e21c327
Showing
49 changed files
with
4,389 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
informational: true | ||
patch: | ||
default: | ||
informational: true |
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @donch1989 @pinglin @xiaofei-du @jvallesm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Contributing Guidelines | ||
|
||
We appreciate your contribution to this amazing project! Any form of engagement is welcome, including but not limiting to | ||
- feature request | ||
- documentation wording | ||
- bug report | ||
- roadmap suggestion | ||
- ...and so on! | ||
|
||
Please refer to the [community contributing section](https://github.com/instill-ai/community#contributing) for more details. | ||
|
||
## Development and codebase contribution | ||
|
||
Before delving into the details to come up with your first PR, please familiarise yourself with the project structure of [Instill Core](https://github.com/instill-ai/community#instill-core). | ||
|
||
### Prerequisites | ||
|
||
- [Instill VDP](https://github.com/instill-ai/vdp) | ||
|
||
### Pre-commit hooks | ||
|
||
check out `.pre-commit-config.yaml` for the set of hooks that we used | ||
|
||
### Local development | ||
|
||
On the local machine, clone `vdp` repository in your workspace, move to the repository folder, and launch all dependent microservices: | ||
```bash | ||
$ cd <your-workspace> | ||
$ git clone https://github.com/instill-ai/vdp.git | ||
$ cd vdp | ||
$ make latest PROFILE=artifact | ||
``` | ||
|
||
Clone `artifact-backend` repository in your workspace and move to the repository folder: | ||
```bash | ||
$ cd <your-workspace> | ||
$ git clone https://github.com/instill-ai/artifact-backend.git | ||
$ cd artifact-backend | ||
``` | ||
|
||
### Build the dev image | ||
|
||
```bash | ||
$ make build | ||
``` | ||
|
||
### Run the dev container | ||
|
||
```bash | ||
$ make dev | ||
``` | ||
|
||
Now, you have the Go project set up in the container, in which you can compile and run the binaries together with the integration test in each container shell. | ||
|
||
### Run the server | ||
|
||
```bash | ||
$ docker exec -it artifact-backend /bin/bash | ||
$ go run ./cmd/migration | ||
$ go run ./cmd/main | ||
``` | ||
|
||
### Run the temporal worker | ||
|
||
```bash | ||
$ docker exec -it artifact-backend /bin/bash | ||
$ go run ./cmd/worker | ||
``` | ||
|
||
### Run the integration test | ||
|
||
```bash | ||
$ docker exec -it artifact-backend /bin/bash | ||
$ make integration-test | ||
``` | ||
|
||
### Stop the dev container | ||
|
||
```bash | ||
$ make stop | ||
``` | ||
|
||
### Remove the dev container | ||
|
||
```bash | ||
$ make rm | ||
``` | ||
|
||
### Sending PRs | ||
|
||
Please take these general guidelines into consideration when you are sending a PR: | ||
|
||
1. **Fork the Repository:** Begin by forking the repository to your GitHub account. | ||
2. **Create a New Branch:** Create a new branch to house your work. Use a clear and descriptive name, like `<your-github-username>/<what-your-pr-about>`. | ||
3. **Make and Commit Changes:** Implement your changes and commit them. We encourage you to follow these best practices for commits to ensure an efficient review process: | ||
- Adhere to the [conventional commits guidelines](https://www.conventionalcommits.org/) for meaningful commit messages. | ||
- Follow the [7 rules of commit messages](https://chris.beams.io/posts/git-commit/) for well-structured and informative commits. | ||
- Rearrange commits to squash trivial changes together, if possible. Utilize [git rebase](http://gitready.com/advanced/2009/03/20/reorder-commits-with-rebase.html) for this purpose. | ||
4. **Push to Your Branch:** Push your branch to your GitHub repository: `git push origin feat/<your-feature-name>`. | ||
5. **Open a Pull Request:** Initiate a pull request to our repository. Our team will review your changes and collaborate with you on any necessary refinements. | ||
|
||
When you are ready to send a PR, we recommend you to first open a `draft` one. This will trigger a bunch of `tests` [workflows](https://github.com/instill-ai/artifact-backend/tree/main/.github/workflows) running a thorough test suite on multiple platforms. After the tests are done and passed, you can now mark the PR `open` to notify the codebase owners to review. We appreciate your endeavour to pass the integration test for your PR to make sure the sanity with respect to the entire scope of **Instill Core**. | ||
|
||
### CI/CD | ||
|
||
- **pull_request** to the `main` branch will trigger the **`Integration Test`** workflow running the integration test using the image built on the PR head branch. | ||
- **push** to the `main` branch will trigger | ||
- the **`Integration Test`** workflow building and pushing the `:latest` image on the `main` branch, following by running the integration test, and | ||
- the **`Release Please`** workflow, which will create and update a PR with respect to the up-to-date `main` branch using [release-please-action](https://github.com/google-github-actions/release-please-action). | ||
|
||
Once the release PR is merged to the `main` branch, the [release-please-action](https://github.com/google-github-actions/release-please-action) will tag and release a version correspondingly. | ||
|
||
The images are pushed to Docker Hub [repository](https://hub.docker.com/r/instill/artifact-backend). | ||
|
||
## Last words | ||
|
||
Your contributions make a difference. Let's build something amazing together! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
instill vdp: | ||
- "**" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Add Label to PR | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
triage: | ||
uses: instill-ai/.github/.github/workflows/add-label-to-pr.yml@main | ||
secrets: | ||
botGitHubToken: ${{ secrets.botGitHubToken }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Add PR to Project | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
track_pr: | ||
uses: instill-ai/.github/.github/workflows/add-to-prj.yml@main | ||
with: | ||
project_number: 5 | ||
secrets: | ||
botGitHubToken: ${{ secrets.botGitHubToken }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Code Scanning | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
paths-ignore: | ||
- "**/*.md" | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
jobs: | ||
CodeQL-Build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Load .env file | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: .env | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: go | ||
queries: security-and-quality | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Coverage | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
codecov: | ||
name: codecov | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Load .env file | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: .env | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Generate coverage report | ||
run: | | ||
go mod tidy | ||
go test -race ./... -coverprofile=coverage.txt -covermode=atomic | ||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
file: ./coverage.txt | ||
flags: unittests | ||
name: codecov-umbrella |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: golangci-lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54 | ||
args: --timeout=10m |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Build and Push Images | ||
|
||
on: | ||
workflow_call: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
docker-hub: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.botGitHubToken }} | ||
|
||
- name: Load .env file | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: .env | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: dropletbot | ||
password: ${{ secrets.botDockerHubPassword }} | ||
|
||
- name: Build and push (latest) | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
push: true | ||
build-args: | | ||
SERVICE_NAME=artifact-backend | ||
GOLANG_VERSION=${{ env.GOLANG_VERSION }} | ||
tags: instill/artifact-backend:latest | ||
cache-from: type=registry,ref=instill/artifact-backend:buildcache | ||
cache-to: type=registry,ref=instill/artifcat-backend:buildcache,mode=max | ||
|
||
- name: Set Versions | ||
if: github.event_name == 'release' | ||
uses: actions/github-script@v6 | ||
id: set_version | ||
with: | ||
script: | | ||
const tag = '${{ github.ref_name }}' | ||
const no_v_tag = tag.replace('v', '') | ||
core.setOutput('tag', tag) | ||
core.setOutput('no_v_tag', no_v_tag) | ||
- name: Build and push (release) | ||
if: github.event_name == 'release' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
push: true | ||
build-args: | | ||
SERVICE_NAME=artifact-backend | ||
GOLANG_VERSION=${{ env.GOLANG_VERSION }} | ||
tags: instill/artifact-backend:${{steps.set_version.outputs.no_v_tag}} | ||
cache-from: type=registry,ref=instill/artifact-backend:buildcache | ||
cache-to: type=registry,ref=instill/artifact-backend:buildcache,mode=max |
Oops, something went wrong.