mirror of
https://github.com/gomods/athens
synced 2026-02-03 08:40:31 +00:00
chore: update workflows for consistency (#2053)
This commit is contained in:
+88
-12
@@ -1,31 +1,47 @@
|
|||||||
---
|
name: Continuous Integration
|
||||||
name: continuous-integration
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GOLANGCI_LINT_VERSION: v2.0.2
|
GOLANGCI_LINT_VERSION: v2.1.6
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# We need to set a cache marker to ensure that the cache is individual for each job.
|
||||||
|
- name: Add Cache Marker
|
||||||
|
run: echo "lint" > env.txt
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
id: install-go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
cache: true
|
cache-dependency-path: |
|
||||||
|
go.sum
|
||||||
|
env.txt
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
if: steps.install-go.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
- name: Lint code
|
- name: Lint code
|
||||||
uses: golangci/golangci-lint-action@v7
|
uses: golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||||
|
|
||||||
build:
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
ATHENS_MONGO_STORAGE_URL: mongodb://localhost:27017
|
ATHENS_MONGO_STORAGE_URL: mongodb://localhost:27017
|
||||||
ATHENS_MINIO_ENDPOINT: http://localhost:9000
|
ATHENS_MINIO_ENDPOINT: http://localhost:9000
|
||||||
@@ -39,12 +55,13 @@ jobs:
|
|||||||
REDIS_SENTINEL_TEST_PROTECTED_MASTER_NAME: protectedredis-1
|
REDIS_SENTINEL_TEST_PROTECTED_MASTER_NAME: protectedredis-1
|
||||||
ATHENS_PROTECTED_REDIS_PASSWORD: AthensPass1
|
ATHENS_PROTECTED_REDIS_PASSWORD: AthensPass1
|
||||||
GA_PULL_REQUEST: ${{github.event.number}}
|
GA_PULL_REQUEST: ${{github.event.number}}
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
services:
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo
|
image: mongo
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 27017:27017
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: minio/minio:edge-cicd
|
image: minio/minio:edge-cicd
|
||||||
ports:
|
ports:
|
||||||
@@ -52,10 +69,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MINIO_ACCESS_KEY: minio
|
MINIO_ACCESS_KEY: minio
|
||||||
MINIO_SECRET_KEY: minio123
|
MINIO_SECRET_KEY: minio123
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
|
|
||||||
redis-sentinel:
|
redis-sentinel:
|
||||||
image: bitnami/redis-sentinel
|
image: bitnami/redis-sentinel
|
||||||
env:
|
env:
|
||||||
@@ -65,6 +84,7 @@ jobs:
|
|||||||
REDIS_SENTINEL_QUORUM: "1"
|
REDIS_SENTINEL_QUORUM: "1"
|
||||||
ports:
|
ports:
|
||||||
- 26379:26379
|
- 26379:26379
|
||||||
|
|
||||||
protectedredis:
|
protectedredis:
|
||||||
image: bitnami/redis
|
image: bitnami/redis
|
||||||
ports:
|
ports:
|
||||||
@@ -72,6 +92,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
REDIS_PORT_NUMBER: 6380
|
REDIS_PORT_NUMBER: 6380
|
||||||
REDIS_PASSWORD: AthensPass1
|
REDIS_PASSWORD: AthensPass1
|
||||||
|
|
||||||
redis-sentinel-protected-redis:
|
redis-sentinel-protected-redis:
|
||||||
image: bitnami/redis-sentinel
|
image: bitnami/redis-sentinel
|
||||||
env:
|
env:
|
||||||
@@ -83,17 +104,72 @@ jobs:
|
|||||||
REDIS_SENTINEL_PORT_NUMBER: 26380
|
REDIS_SENTINEL_PORT_NUMBER: 26380
|
||||||
ports:
|
ports:
|
||||||
- 26380:26380
|
- 26380:26380
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# We need to set a cache marker to ensure that the cache is individual for each job.
|
||||||
|
- name: Add Cache Marker
|
||||||
|
run: echo "test" > env.txt
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
id: install-go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
cache: true
|
cache-dependency-path: |
|
||||||
|
go.sum
|
||||||
|
env.txt
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
if: steps.install-go.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
- name: Verify changes
|
- name: Verify changes
|
||||||
run: make verify
|
run: make verify
|
||||||
|
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: go test -v -race ./...
|
run: go test -v -race ./...
|
||||||
|
|
||||||
- name: End to end tests
|
- name: End to end tests
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: make test-e2e
|
run: make test-e2e
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# We need to set a cache marker to ensure that the cache is individual for each job.
|
||||||
|
- name: Add Cache Marker
|
||||||
|
run: echo "build" > env.txt
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
id: install-go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: 'go.mod'
|
||||||
|
cache-dependency-path: |
|
||||||
|
go.sum
|
||||||
|
env.txt
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
if: steps.install-go.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
|
- name: Capture Current Date
|
||||||
|
id: date
|
||||||
|
run: echo "::set-output name=date::$(date -u '+%Y-%m-%d-%H:%M:%S-%Z')"
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release --clean --snapshot
|
||||||
|
env:
|
||||||
|
DATE: ${{ steps.date.outputs.date }}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
name: "CodeQL Security Scanning"
|
name: "CodeQL Security Scanning"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|||||||
@@ -1,24 +1,34 @@
|
|||||||
---
|
name: Publish Build Artifacts
|
||||||
name: publish github release artifacts with goreleaser
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: '*'
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: unshallow
|
with:
|
||||||
run: git fetch --prune --unshallow
|
fetch-depth: 0
|
||||||
- name: setup-go
|
|
||||||
|
- name: Set up Go
|
||||||
|
id: install-go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
- name: capture current date
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
if: steps.install-go.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
|
- name: Capture Current Date
|
||||||
id: date
|
id: date
|
||||||
run: echo "::set-output name=date::$(date -u '+%Y-%m-%d-%H:%M:%S-%Z')"
|
run: echo "::set-output name=date::$(date -u '+%Y-%m-%d-%H:%M:%S-%Z')"
|
||||||
- name: goreleaser
|
|
||||||
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v6
|
uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
name: Release canary and commit tags
|
name: Release canary
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-push-main:
|
docker-push-main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
name: release-latest
|
name: Release Docker Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-push-main:
|
docker-push-main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ linters:
|
|||||||
- exhaustruct
|
- exhaustruct
|
||||||
- forbidigo
|
- forbidigo
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
|
- funcorder
|
||||||
- funlen
|
- funlen
|
||||||
- gochecknoglobals
|
- gochecknoglobals
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
|
|||||||
Reference in New Issue
Block a user