Skip to content

Commit a16a541

Browse files
ChandruShettyahsan-z-khanazhouwdAnqiPangdavidhsingyuchen
committed
Initial commit
Co-authored-by: Ahsan Khan <[email protected]> Co-authored-by: Ang Zhou <[email protected]> Co-authored-by: Anqi Pang <[email protected]> Co-authored-by: Hsing-Yu Chen <[email protected]> Co-authored-by: Justin Alvarez <[email protected]> Co-authored-by: Kevin Li <[email protected]> Co-authored-by: Monirul Islam <[email protected]> Co-authored-by: Mrudul Harwani <[email protected]> Co-authored-by: Sam Berning <[email protected]> Co-authored-by: Vishwas Siravara <[email protected]> Co-authored-by: Weike Qu <[email protected]> Co-authored-by: Ziwen Ning <[email protected]>
0 parents  commit a16a541

File tree

98 files changed

+10288
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+10288
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help improve Finch
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
Briefly describe the probem you are having.
12+
13+
14+
**Steps to reproduce**
15+
A clear, step-by-step set of instructions to reproduce the bug.
16+
17+
18+
**Expected behavior**
19+
Description of what you expected to happen.
20+
21+
22+
**Screenshots or logs**
23+
If applicable, add screenshots or logs to help explain your problem.
24+
25+
26+
27+
**Additional context**
28+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/runfinch/finch/discussions
5+
about: Use GitHub Discussions to ask questions, discuss options, or propose new ideas
6+
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature for Finch
4+
title: ''
5+
labels: 'feature'
6+
assignees: ''
7+
8+
---
9+
10+
**What is the problem you're trying to solve?.**
11+
A clear and concise description of the use case for this feature. Please provide an example, if possible.
12+
13+
14+
**Describe the feature you'd like**
15+
A clear and concise description of what you'd like to happen.
16+
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Issue #, if available:
2+
3+
*Description of changes:*
4+
5+
*Testing done:*
6+
7+
8+
9+
- [ ] I've reviewed the guidance in CONTRIBUTING.md
10+
11+
12+
#### License Acceptance
13+
14+
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/bin/update-lima-dep.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
CLOUDFRONT_URL="https://deps.runfinch.com/"
4+
AARCH64_FILENAME_PATTERN="aarch64/lima-and-qemu.macos-aarch64.[0-9].*\.gz$"
5+
AMD64_FILENAME_PATTERN="x86-64/lima-and-qemu.macos-x86_64.[0-9].*\.gz$"
6+
AARCH64="aarch64"
7+
X86_64="x86-64"
8+
set -x
9+
10+
while getopts b: flag
11+
do
12+
case "${flag}" in
13+
b) bucket=${OPTARG};;
14+
esac
15+
done
16+
[[ -z "$bucket" ]] && { echo "Error: Bucket not set"; exit 1; }
17+
18+
aarch64Deps=$(aws s3 ls s3://${bucket}/${AARCH64}/ --recursive | grep "$AARCH64_FILENAME_PATTERN" | sort | tail -n 1 | awk '{print $4}')
19+
20+
[[ -z "$aarch64Deps" ]] && { echo "Error: aarch64 dependency not found"; exit 1; }
21+
22+
23+
amd64Deps=$(aws s3 ls s3://${bucket}/${X86_64}/ --recursive | grep "$AMD64_FILENAME_PATTERN" | sort | tail -n 1 | awk '{print $4}')
24+
25+
[[ -z "$amd64Deps" ]] && { echo "Error: x86_64 dependency not found"; exit 1; }
26+
27+
sed -E -i.bak 's|^([[:blank:]]*LIMA_URL[[:blank:]]*\?=[[:blank:]]*'${CLOUDFRONT_URL}')('${AARCH64_FILENAME_PATTERN}')|\1'$aarch64Deps'|' Makefile
28+
sed -E -i.bak 's|^([[:blank:]]*LIMA_URL[[:blank:]]*\?=[[:blank:]]*'${CLOUDFRONT_URL}')('${AMD64_FILENAME_PATTERN}')|\1'$amd64Deps'|' Makefile
29+
30+
31+

.github/dependabot.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
commit-message:
8+
# When a dependency is updated,
9+
# we want release-please to treat the corresponding commit as a releasable unit
10+
# because it may contain a security fix.
11+
#
12+
# Re. how that is achieved, see `changelog-types` in workflows/release-please.yml.
13+
prefix: "build"
14+
include: "scope"
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
schedule:
18+
interval: "daily"
19+
commit-message:
20+
prefix: "ci"
21+
include: "scope"

.github/workflows/ci.yaml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# When a third-party action is added (i.e., `uses`), please also add it to `download-licenses` in Makefile.
2+
name: CI
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '*.md'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
gen-code-no-diff:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-go@v3
23+
with:
24+
go-version-file: go.mod
25+
cache: true
26+
- run: make gen-code
27+
- run: git diff --exit-code
28+
unit-tests:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-go@v3
33+
with:
34+
# Since this repository is not meant to be used as a library,
35+
# we don't need to test the latest 2 major releases like Go does: https://go.dev/doc/devel/release#policy.
36+
go-version-file: go.mod
37+
cache: true
38+
- run: make test-unit
39+
# It's recommended to run golangci-lint in a job separate from other jobs (go test, etc) because different jobs run in parallel.
40+
go-linter:
41+
runs-on: ubuntu-latest
42+
# TODO: Remove this when we make the repos public.
43+
env:
44+
GOPRIVATE: github.com/runfinch/common-tests
45+
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
46+
steps:
47+
- uses: actions/checkout@v3
48+
- uses: actions/setup-go@v3
49+
with:
50+
go-version-file: go.mod
51+
cache: true
52+
# TODO: Remove this when we make the repos public.
53+
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
54+
- name: golangci-lint
55+
uses: golangci/golangci-lint-action@v3
56+
with:
57+
# Pin the version in case all the builds start to fail at the same time.
58+
# There may not be an automatic way (e.g., dependabot) to update a specific parameter of a Github Action,
59+
# so we will just update it manually whenever it makes sense (e.g., a feature that we want is added).
60+
version: v1.50.0
61+
args: --fix=false
62+
go-mod-tidy-check:
63+
runs-on: ubuntu-latest
64+
# TODO: Remove this when we make the repos public.
65+
env:
66+
GOPRIVATE: github.com/runfinch/common-tests
67+
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
68+
steps:
69+
- uses: actions/checkout@v3
70+
- uses: actions/setup-go@v3
71+
with:
72+
go-version-file: go.mod
73+
cache: true
74+
# TODO: Remove this when we make the repos public.
75+
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
76+
# TODO: Use `go mod tidy --check` after https://github.com/golang/go/issues/27005 is fixed.
77+
- run: go mod tidy
78+
- run: git diff --exit-code
79+
check-licenses:
80+
runs-on: ubuntu-latest
81+
# TODO: Remove this when we make the repos public.
82+
env:
83+
GOPRIVATE: github.com/runfinch/common-tests
84+
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
85+
steps:
86+
- uses: actions/checkout@v3
87+
- uses: actions/setup-go@v3
88+
with:
89+
go-version-file: go.mod
90+
cache: true
91+
# TODO: Remove this when we make the repos public.
92+
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
93+
- run: make check-licenses
94+
e2e-tests:
95+
strategy:
96+
fail-fast: false
97+
matrix:
98+
os: [[self-hosted, macos, amd64, 11.7], [self-hosted, macos, amd64, 12.6], [self-hosted, macos, arm64, 11.7], [self-hosted, macos, arm64, 12.6]]
99+
runs-on: ${{ matrix.os }}
100+
# TODO: Remove this when we make the repos public
101+
env:
102+
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
103+
steps:
104+
- uses: actions/checkout@v3
105+
- name: Clean up previous files
106+
run: |
107+
sudo rm -rf /opt/finch
108+
sudo rm -rf ~/.finch
109+
- run: brew install go lz4 automake autoconf libtool
110+
- name: Build project
111+
run: |
112+
export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH"
113+
which libtool
114+
make
115+
# TODO: Remove this when we make the repos public
116+
- name: Configure repo access
117+
run: git config --global url.https://[email protected]/.insteadOf https://github.com/
118+
- run: make test-e2e

.github/workflows/lint-pr-title.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# When a third-party action is added (i.e., `uses`), please also add it to `download-licenses` in Makefile.
2+
name: "Lint PR Title"
3+
4+
on:
5+
# TODO: Change to pull_request_target after the repo is public.
6+
pull_request:
7+
types:
8+
- opened
9+
- edited
10+
- reopened
11+
- synchronize
12+
13+
jobs:
14+
main:
15+
name: conventional-commit
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-please.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# When a third-party action is added (i.e., `uses`), please also add it to `download-licenses` in Makefile.
2+
on:
3+
push:
4+
branches:
5+
- main
6+
name: release-please
7+
jobs:
8+
release-please:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: google-github-actions/release-please-action@v3
12+
with:
13+
release-type: go
14+
package-name: finch
15+
# Include 'build' in the changelog and
16+
# make it a releasable unit (patch version bump) because dependabot PRs uses it.
17+
# For more details, see ../dependabot.yml.
18+
#
19+
# The mapping from type to section comes from conventional-commit-types [1]
20+
# which is used by action-semantic-pull-request [2],
21+
# which is used by us.
22+
#
23+
# [1] https://github.com/commitizen/conventional-commit-types/blob/master/index.json
24+
# [2] https://github.com/amannn/action-semantic-pull-request/blob/0b14f54ac155d88e12522156e52cb6e397745cfd/README.md?plain=1#L60
25+
changelog-types: >
26+
[
27+
{
28+
"type":"feat",
29+
"section":"Features",
30+
"hidden":false
31+
},
32+
{
33+
"type":"fix",
34+
"section":"Bug Fixes",
35+
"hidden":false
36+
},
37+
{
38+
"type":"build",
39+
"section":"Build System or External Dependencies",
40+
"hidden":false
41+
}
42+
]
43+
# Before we are at v1.0.0
44+
bump-minor-pre-major: true
45+

.github/workflows/update-deps.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update dependencies
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
# This is required for configure-aws-credentials to request an OIDC JWT ID token to access AWS resources later on.
7+
# More info: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
8+
id-token: write
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update-deps:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: configure aws credentials
20+
uses: aws-actions/configure-aws-credentials@v1
21+
with:
22+
role-to-assume: ${{ secrets.ROLE }}
23+
role-session-name: dependency-upload-session
24+
aws-region: ${{ secrets.REGION }}
25+
26+
# This step fetches the latest set of released dependencies from s3 and updates the Makefile to use the same.
27+
- name: update dependencies url
28+
run: |
29+
./.github/bin/update-lima-dep.sh -b ${{ secrets.DEPENDENCY_BUCKET_NAME }}
30+
31+
- name: create PR
32+
uses: peter-evans/create-pull-request@v4
33+
with:
34+
# A Personal Access Token instead of the default `GITHUB_TOKEN` is required
35+
# to trigger the checks (e.g., e2e tests) on the created pull request.
36+
# More info: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs
37+
# TODO: Use FINCH_BOT_TOKEN instead of GITHUB_TOKEN.
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
# TODO: Add updated lima version in the title.
40+
title: 'build(deps): Bump lima version'

0 commit comments

Comments
 (0)