Skip to content

Medzoner is testing out GitHub Actions 🚀 #107

Medzoner is testing out GitHub Actions 🚀

Medzoner is testing out GitHub Actions 🚀 #107

name: release-medzoner-go
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- master
paths-ignore:
- '.vscode/**'
jobs:
ci-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...
- run: cp .env.github .env
# - run: go install honnef.co/go/tools/cmd/staticcheck@master
# - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0
# - run: go install github.com/gordonklaus/ineffassign@latest
# - run: go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
# - run: make run-qa
ci-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- run: cp .env.github .env
- run: make test_all
- name: Archive code coverage results
uses: actions/upload-artifact@v4.3.3
with:
name: code-coverage-report
path: coverage.out
# retention-days: 1
env:
GOPATH: /home/runner/work/medzoner-go/go
cd-release:
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: [ '1.22.x' ]
needs: [ ci-lint, ci-test ]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- run: cp .env.github .env
- run: make build
#- run: docker run --rm -i hadolint/hadolint < docker/Dockerfile
- run: .github/push.sh
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GIT_BRANCH: ${{ github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
GOPATH: /home/runner/work/medzoner-go/go
cd-deploy:
runs-on: ubuntu-latest
needs: [ cd-release ]
steps:
# - run: argocd app set medzoner-master --helm-set image.tag=${{ github.ref_name }}-${{ github.sha }} --revision ${{ github.ref_name }}-${{ github.sha }}
- uses: actions/checkout@v4
name: GitOps - Checkout
with:
repository: Medzoner/medzoner-gitops
ref: 'master'
token: ${{ secrets.CI_JOB_TOKEN }}
fetch-depth: 0
path: medzoner-gitops
- name: GitOps - Patch and push
run: |
git -C medzoner-gitops config user.name "medzoner"
git -C medzoner-gitops config user.email "medzoner@medzoner.com"
sed -i "s/ tag:.*/ tag: ${{ github.ref_name }}-${{ github.sha }}/" "medzoner-gitops/charts/medzoner/values.yaml"
git -C medzoner-gitops commit -am "medzoner ${{ github.ref_name }}-${{ github.sha }}"
git -C medzoner-gitops push origin master
# - name: Update values.yaml
# run: |
# cd helm
# sed -i 's|APP_VERSION:.*|APP_VERSION: '${{ github.sha }}'|' values.yaml
# git config --global user.name 'GitHub Actions'
# git config --global user.email 'actions@github.com'
# git add values.yaml
# git commit -m "Update values.yaml"
# git push
env:
GIT_BRANCH: ${{ github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
cd-coverage-report:
runs-on: ubuntu-22.04
needs: [ cd-release ]
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: code-coverage-report
- run: go install github.com/modocache/gover@latest
- run: go install github.com/mattn/goveralls@latest
- run: goveralls -coverprofile=coverage.out -service=travis-ci -repotoken "${COVERALLS_TOKEN}";
- name: update goreportcard
uses: creekorful/goreportcard-action@v1.0
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
GOPATH: /home/runner/work/medzoner-go/go