add discord link #304
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_call: | |
inputs: | |
version: | |
required: false | |
type: string | |
secrets: | |
DOCKERHUB_USER: | |
required: true | |
DOCKERHUB_TOKEN: | |
required: true | |
jobs: | |
Lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.51.2 | |
args: --timeout 3m | |
Test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: "write" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- name: Run tests | |
run: | | |
set -euo pipefail | |
go install gotest.tools/gotestsum@latest | |
gotestsum -- -coverprofile coverage.out -covermode=count ./... | |
- uses: seriousben/go-patch-cover-action@v1 | |
if: github.event_name != 'workflow_call' | |
Push: | |
name: Push container and chart to registry | |
if: github.ref == 'refs/heads/main' | |
needs: [Lint, Test] | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: docker.io | |
DOCKER_REPO: docker.io/valkyriefnd | |
HELM_REPO: docker.io/valkyriefnd/ | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetch all revision and tags, necessary for .github/tools/version.sh | |
- name: Install Task | |
uses: arduino/setup-task@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set input version | |
if: github.event.inputs.version != '' | |
run: | | |
[[ ${{ inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] | |
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV | |
- name: Calculate version | |
if: github.event.inputs.version == '' | |
run: | | |
echo "VERSION=$(task version)" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta_v | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
valkyriefnd/valkyrie | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=raw,value=${{ env.VERSION }} | |
type=raw,value=latest | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ${{ steps.meta_v.outputs.tags }} | |
labels: ${{ steps.meta_v.outputs.labels }} | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push chart to registry | |
run: | | |
task helm:push |