-
Notifications
You must be signed in to change notification settings - Fork 4
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
David Ragot
committed
Oct 9, 2024
1 parent
e0764a7
commit 015fa90
Showing
118 changed files
with
8,032 additions
and
677 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,19 @@ | ||
root = true | ||
|
||
[Earthfile] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.tpl] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{yaml,yml}] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
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,15 @@ | ||
name: Base | ||
description: Base Earthly action | ||
runs: | ||
using: composite | ||
steps: | ||
- shell: bash | ||
name: Put back the git branch into git (Earthly uses it for tagging) | ||
run: | | ||
branch="" | ||
if [ -n "$GITHUB_HEAD_REF" ]; then | ||
branch="$GITHUB_HEAD_REF" | ||
else | ||
branch="${GITHUB_REF##*/}" | ||
fi | ||
git checkout -b "$branch" || true |
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,11 @@ | ||
name: Pre-Commit | ||
description: Run pre-commit checks with Earthly | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Base Earthly action | ||
uses: ./.github/actions/earthly/base | ||
- name: PreCommit | ||
shell: bash | ||
run: > | ||
earthly +pre-commit |
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,15 @@ | ||
name: Dirty | ||
description: Check if the current state is dirty | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Get changed files | ||
id: changed-files | ||
shell: bash | ||
run: | | ||
hasChanged=$(git status --porcelain) | ||
if (( $(echo ${#hasChanged}) != 0 )); then | ||
git status | ||
echo "There are changes in the repository" | ||
exit 1 | ||
fi |
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,26 @@ | ||
inputs: | ||
CHART_NAME: | ||
required: true | ||
description: "Name of the chart to package" | ||
CHART_DIR: | ||
required: true | ||
description: "Path to the chart to package" | ||
default: ".helm" | ||
|
||
name: AnyChart | ||
description: AnyChart workflow | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Validate | ||
uses: ./.github/actions/helm/validate | ||
with: | ||
CHART_PATH: ./${{ inputs.CHART_DIR }}/${{ inputs.CHART_NAME }} | ||
- name: Dirty | ||
uses: ./.github/actions/github/dirty | ||
- name: Package | ||
uses: ./.github/actions/helm/package | ||
with: | ||
CHART_NAME: ${{ inputs.CHART_NAME }} | ||
CHART_PATH: ./${{ inputs.CHART_DIR }}/${{ inputs.CHART_NAME }} |
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,29 @@ | ||
inputs: | ||
CHART_PATH: | ||
description: "Path to the chart to package" | ||
required: true | ||
CHART_NAME: | ||
description: "Name of the chart to package" | ||
required: true | ||
|
||
name: Package | ||
description: Package a chart | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Base Earthly action | ||
uses: ./.github/actions/earthly/base | ||
- uses: "actions/checkout@v4" | ||
with: | ||
fetch-depth: 0 | ||
- name: Package | ||
shell: bash | ||
env: | ||
CHART_PATH: ${{ inputs.CHART_PATH }} | ||
run: > | ||
earthly $CHART_PATH+package | ||
- name: Archive chart | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.CHART_NAME }}_${{ github.ref_type == 'branch' && github.sha || github.ref_name }}.tgz | ||
path: ${{ inputs.CHART_PATH }}/*.tgz |
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,29 @@ | ||
inputs: | ||
GH_TOKEN: | ||
description: "Github token to access the ghcr registry" | ||
required: true | ||
CHART_PATH: | ||
description: "Path to the chart to publish" | ||
required: true | ||
|
||
name: Publish | ||
description: Publish a chart | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Base Earthly action | ||
uses: ./.github/actions/earthly/base | ||
- uses: "actions/checkout@v4" | ||
with: | ||
fetch-depth: 0 | ||
- name: Publish | ||
shell: bash | ||
run: > | ||
earthly | ||
--no-output | ||
--allow-privileged | ||
--secret GITHUB_TOKEN=$GH_TOKEN | ||
$CHART_PATH+publish | ||
env: | ||
GH_TOKEN: ${{ inputs.GH_TOKEN }} | ||
CHART_PATH: ${{ inputs.CHART_PATH }} |
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,21 @@ | ||
inputs: | ||
CHART_PATH: | ||
description: "Path to the chart to package" | ||
required: true | ||
|
||
name: Validate | ||
description: Validate a chart | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Base Earthly action | ||
uses: ./.github/actions/earthly/base | ||
- uses: "actions/checkout@v4" | ||
with: | ||
fetch-depth: 0 | ||
- name: Validate | ||
shell: bash | ||
run: > | ||
earthly $CHART_PATH+validate | ||
env: | ||
CHART_PATH: ${{ inputs.CHART_PATH }} |
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,12 @@ | ||
docs: | ||
- changed-files: | ||
- any-glob-to-any-file: "**/*.md" | ||
|
||
feature: | ||
- head-branch: ["^feat", "feat"] | ||
|
||
bug: | ||
- head-branch: ["^fix", "fix"] | ||
|
||
release: | ||
- base-branch: "main" |
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: "Dependencies" | ||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
dependencies: | ||
name: Update Dependencies | ||
runs-on: formance-runner | ||
strategy: | ||
matrix: | ||
chart: ["membership"] | ||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# added or changed files to the repository. | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update Dependencies | ||
run: earthly ./charts/${{ matrix.chart }}+dependencies | ||
|
||
- name: Increment version | ||
run: earthly ./charts/+increment-version --CHART $${{ matrix.chart }} | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
branch: chore/dependencies-${{matrix.chart}}-${{ github.sha }} | ||
commit_message: "chore(dependencies): update dependencies for ${{ matrix.chart }}" | ||
|
||
# - name: this need to create a pull request with all the changed files | ||
# - name: Create Pull Request | ||
# uses: peter-evans/create-pull-request@v7 |
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,50 @@ | ||
name: "Pull Request Labeler" | ||
on: | ||
pull_request: | ||
types: [ assigned, opened, synchronize, reopened, labeled, unlabeled ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
labeler: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: formance-runner | ||
steps: | ||
- uses: 'actions/checkout@v4' | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/labeler@v5 | ||
with: | ||
sync-labels: true | ||
- name: Retrieve chart changes | ||
id: chart_changes | ||
run: | | ||
CHARTS=$(git diff origin/main --stat | grep -oE 'charts/[^/]+/' | sed 's|charts/||;s|/||' | sort -u | jq -R -s -c 'split("\n") | map(select(. != ""))') | ||
echo "Changed charts: $CHARTS" | ||
echo "::set-output name=changed_charts::$CHARTS" | ||
- name: Label PR based on chart changes | ||
if: steps.chart_changes.outputs.changed_charts != '' | ||
uses: actions/github-script@v7 | ||
env: | ||
CHARTS: ${{ steps.chart_changes.outputs.changed_charts }} | ||
with: | ||
script: | | ||
const charts = JSON.parse(process.env.CHARTS); | ||
const labels = charts.map(chart => `chart-${chart.trim()}`).filter(label => label.length > 0); | ||
if (labels.length > 0) { | ||
console.log(`Applying labels: ${labels.join(', ')}`); | ||
await github.rest.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
labels: labels | ||
}); | ||
} else { | ||
console.log('No charts changed, skipping labeling.'); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.