feat: use github actions #2
Workflow file for this run
This file contains hidden or 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: CICD | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
env: | |
GO_VERSION: "1.23.5" | |
GOLANGCI_LINT_VERSION: v1.60.1 | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image | |
run: docker build -t code-review-exercise-node:${{ github.sha }} . | |
# generate: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Install Go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: ${{ env.GO_VERSION }} | |
# - name: Run go generate commands | |
# run: make gen | |
# - name: Run go mod | |
# run: make mod | |
# - name: Verify generated files match committed versions | |
# run: git status --porcelain=v1 | tee /dev/stderr | wc -l | grep -qE '^ *0 *$' | |
# gitleaks: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# - name: Run Gitleaks | |
# uses: gitleaks/gitleaks-action@v2 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} | |
# lint: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Install Go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: ${{ env.GO_VERSION }} | |
# - name: Run golangci-lint | |
# uses: golangci/golangci-lint-action@v6 | |
# with: | |
# version: ${{ env.GOLANGCI_LINT_VERSION }} | |
# snyk: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Run Snyk to check for vulnerabilities | |
# uses: snyk/actions/[email protected] | |
# env: | |
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
# test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Install Go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: ${{ env.GO_VERSION }} | |
# - name: Run tests | |
# run: go test -v --race -coverprofile=covprofile ./... |