This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Merge pull request #432 from kostis-codefresh/patch-2 #705
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: | |
push: | |
branches: | |
- 'master' | |
- 'release-*' | |
pull_request: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/setup-go@v1 | |
with: | |
go-version: '1.16.2' | |
- name: Add ~/go/bin to PATH | |
run: | | |
echo "/home/runner/go/bin" >> $GITHUB_PATH | |
- name: Validate code generation | |
run: | | |
set -xo pipefail | |
go mod download && go mod tidy && make generate | |
git diff --exit-code -- . | |
- run: make test | |
- uses: golangci/golangci-lint-action@v2 | |
with: | |
version: v1.38.0 | |
args: --timeout 5m | |
env: | |
GOROOT: "" | |
- uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.out | |
publish: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout repo | |
uses: actions/checkout@master | |
- | |
name: Build image tag | |
run: echo "IMAGE_TAG=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_ENV | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GH_PAT }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm | |
push: true | |
tags: | | |
ghcr.io/argoproj-labs/argocd-notifications:latest | |
ghcr.io/argoproj-labs/argocd-notifications:${{ env.IMAGE_TAG }} | |
argoprojlabs/argocd-notifications:latest | |
file: ./Dockerfile | |
build-args: | | |
IMAGE_TAG=${{ env.IMAGE_TAG }} |