feat(frontend): Switch to vite for frontend #54
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: Build and Test & publish | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
concurrency: | |
group: ${{ github.repository }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Setup dependencies | |
run: make setup-backend env | |
- name: Generate code from spec | |
run: make generate-backend | |
- name: Run go vet | |
run: go vet ./... | |
- name: Run backend tests | |
run: make test-backend-cov | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: backend-reports | |
path: reports | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ./web/app/.nvmrc | |
cache: yarn | |
cache-dependency-path: '**/yarn.lock' | |
- name: Setup dependencies | |
run: make setup-frontend env | |
- name: Generate code from spec | |
run: make generate-frontend | |
- name: Run frontend tests | |
run: make test-frontend | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-reports | |
path: reports | |
docker: | |
runs-on: ubuntu-latest | |
needs: | |
- frontend | |
- backend | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
sonar: | |
runs-on: ubuntu-latest | |
needs: | |
- publish | |
if: ${{ always() && (needs.publish.result == 'skipped' || needs.publish.result == 'success') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: frontend-reports | |
path: reports | |
- uses: actions/download-artifact@v4 | |
with: | |
name: backend-reports | |
path: reports | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
publish: | |
needs: | |
- docker | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
git-user-name: github-actions | |
git-user-email: [email protected] | |
fallback-version: 0.0.0 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
skip-commit: true | |
version-file: web/app/package.json | |
git-push: false | |
- name: Update version field in OAPI spec file | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq -i '.info.version = "${{ steps.changelog.outputs.version }}"' 'api/openapi.yaml' | |
- name: Update version field of sonar-project.properties | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: sed -i "s/sonar.projectVersion=.*/sonar.projectVersion=${{ steps.changelog.outputs.version }}/" "sonar-project.properties" | |
- name: Commit release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -m "chore(release): ${{ steps.changelog.outputs.tag }} [skip ci]" | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=semver,pattern={{version}},value=${{ steps.changelog.outputs.tag }} | |
- name: Build and push Docker image | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Push changes | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git push origin main --follow-tags | |
- name: Create Release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
draft: false | |
name: ${{ steps.changelog.outputs.tag }} | |
tag: ${{ steps.changelog.outputs.tag }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
token: ${{ github.token }} |