ai-brain: move summary section to the top #134
Workflow file for this run
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
name: Branch and PR build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || 'branch' }} # scope to for the current workflow | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} # cancel only PR related jobs | |
env: | |
GOLANGCI_LINT_TIMEOUT: 5m | |
GORELEASER_CURRENT_TAG: "v0.0.0-latest" | |
BUCKET_NAME: botkube-cloud-plugins-latest | |
jobs: | |
lint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: "Set up Go" | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
# When the files to be extracted are already present, | |
# tar extraction in Golangci Lint fails with the "File exists" | |
# errors. These files appear to be present because of | |
# cache in setup-go, on disabling the cache we are no more seeing | |
# such error. Cache is to be enabled once the fix is available for | |
# this issue: | |
# https://github.com/golangci/golangci-lint-action/issues/807 | |
cache: false | |
- name: "Check code quality" | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }} | |
test: | |
name: Test code | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: "Set up Go" | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: 'true' | |
- name: "Run tests" | |
run: make test | |
build-plugins: | |
name: Build plugins without publish | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
if: github.event_name == 'pull_request' | |
needs: [lint, test] | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: "Set up Go" | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
version: latest | |
- name: Build plugins and generate plugins index.yaml | |
env: | |
PLUGIN_DOWNLOAD_URL_BASE_PATH: "" | |
run: | | |
make build-plugins-archives | |
USE_ARCHIVE=true make gen-plugin-index | |
release-latest-plugins: | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
name: Build and release latest plugins | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: GCP auth | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.CLOUD_PLUGINS_LATEST_BUCKET_CREDS }} | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
version: latest | |
- name: Build plugins and generate plugins index.yaml | |
env: | |
PLUGIN_DOWNLOAD_URL_BASE_PATH: "" | |
run: | | |
make build-plugins-archives | |
USE_ARCHIVE=true make gen-dev-plugin-index | |
- name: Upload plugins to GCS | |
uses: google-github-actions/upload-cloud-storage@v2 | |
with: | |
path: 'dist' | |
destination: '${{ env.BUCKET_NAME }}/' | |
glob: '*.tar.gz' | |
parent: false | |
- name: Upload plugin index to GCS | |
uses: google-github-actions/upload-cloud-storage@v2 | |
with: | |
path: 'plugins-index.yaml' | |
destination: '${{ env.BUCKET_NAME }}/' | |
- name: 'Disable GCS caching' | |
run: 'gsutil -m setmeta -h "Cache-Control: no-cache, no-store" gs://${{ env.BUCKET_NAME }}/*' |