-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimise pipeline for release and daily operation (#222)
refactor gh-action, optimize pipeline for release and daily operation, refactor linter
- Loading branch information
Showing
15 changed files
with
260 additions
and
208 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,83 @@ | ||
name: Main and Pull Request Pipeline | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
paths-ignore: | ||
- '*.md' | ||
- 'assets/**' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Dagger Version | ||
uses: sagikazarmark/[email protected] | ||
|
||
- name: Run Dagger golangci-lint | ||
uses: dagger/dagger-for-github@v6 | ||
with: | ||
version: ${{ steps.dagger_version.outputs.version }} | ||
verb: call | ||
args: lint-report export --path=golangci-lint-report.sarif | ||
|
||
- uses: reviewdog/action-setup@v1 | ||
- name: Run Reviewdog | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
reviewdog -f=sarif -name="Golang Linter Report" -reporter=github-check -filter-mode nofilter -fail-level any -tee < golangci-lint-report.sarif | ||
test-code: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Run Tests | ||
uses: dagger/dagger-for-github@v6 | ||
with: | ||
version: ${{ steps.dagger_version.outputs.version }} | ||
verb: call | ||
args: test | ||
|
||
- name: Build Binary | ||
uses: dagger/dagger-for-github@v6 | ||
with: | ||
version: ${{ steps.dagger_version.outputs.version }} | ||
verb: call | ||
args: build-dev --platform linux/amd64 | ||
|
||
push-snapshop-release: | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
- test-code | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Dagger Version | ||
uses: sagikazarmark/[email protected] | ||
|
||
- name: Push Release | ||
uses: dagger/dagger-for-github@v6 | ||
with: | ||
version: ${{ steps.dagger_version.outputs.version }} | ||
verb: call | ||
args: snapshot-release --github-token=${{ env.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
name: Release Artifacts and Container Images | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
branches: [main] | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
publish-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Call Dagger Function | ||
uses: dagger/dagger-for-github@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
version: "latest" | ||
verb: call | ||
args: release --github-token='env:${{ env.GITHUB_TOKEN }}' | ||
|
||
publish-images: | ||
runs-on: ubuntu-latest | ||
environment: PROD | ||
env: | ||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||
COSIGN_KEY: ${{ secrets.COSIGN_KEY }} | ||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | ||
REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} | ||
PUBLISH_ADDRESS: ${{ vars.PUBLISH_ADDRESS }} | ||
TAG: ${{ github.ref_name }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Call Docker-Publish Function | ||
uses: dagger/dagger-for-github@v6 | ||
with: | ||
version: "latest" | ||
verb: call | ||
args: "publish-image --cosign-password='env:${{ env.COSIGN_PASSWORD }}' --cosign-key='env:${{ env.COSIGN_KEY }}' --reg-username='${{ env.REGISTRY_USERNAME }}' --reg-password='env:${{ env.REGISTRY_PASSWORD }}' --reg-address='${{ env.REGISTRY_ADDRESS }}' --publish-address='${{ env.PUBLISH_ADDRESS }}' --tag='${{ env.TAG }}'" | ||
- name: Notify on success | ||
if: success() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
body: "Container image published successfully! 🎉" | ||
}) | ||
- name: Notify on failure | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
body: "Failed to publish Container image. ❌" | ||
}) |
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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
|
||
run: | ||
timeout: 3m | ||
linters: | ||
enable: | ||
# default linters | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
# Default linters are already enabled, these are the additional ones | ||
- typecheck | ||
- unused | ||
|
||
- gofmt | ||
- gosec | ||
- nilnil | ||
# - wrapcheck | ||
# - gocritic | ||
# - revive #, enable once current issues are resolved | ||
issues: | ||
exclude-dirs: | ||
- dagger/internal | ||
exclude-files: | ||
- ^.*\\.gen\\.go$ |
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
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
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
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
Oops, something went wrong.