Merge pull request #2 from jlucaspains/dependabot/go_modules/backend/… #16
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
# This is a basic workflow to help you get started with Actions | |
name: PR Validation | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
pull-requests: write | |
contents: read | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.0 | |
- name: Pull dependencies | |
run: go mod download | |
working-directory: ./backend | |
- name: Test | |
run: go test -cover ./... > test-result.txt | |
working-directory: ./backend | |
- name: Pull request comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
path: ./backend/test-result.txt | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
sharp-cert-checker | |
tags: | | |
type=ref,event=pr | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./frontend | |
- name: Create .env | |
run: echo "PUBLIC_API_BASE_PATH=http://localhost:3000/api" > .env | |
working-directory: ./frontend | |
- name: Build | |
run: npm run build | |
working-directory: ./frontend |