name: Dashboard CI on: push: branches: [ "master" ] paths: - "dashboard/**" pull_request: branches: [ "master" ] paths: - "dashboard/**" jobs: lint: env: VITE_BASE_API: /api/ runs-on: ubuntu-latest defaults: run: working-directory: ./dashboard steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 name: Install pnpm with: version: 8 run_install: false - name: Get pnpm store directory shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - uses: actions/cache@v3 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: 📥 Install deps run: pnpm install - name: Lint Dashboard run: pnpm lint build: needs: [ lint ] env: VITE_BASE_API: /api/ runs-on: ubuntu-latest defaults: run: working-directory: ./dashboard steps: - uses: actions/checkout@v4 with: fetch-depth: '0' - uses: pnpm/action-setup@v3 name: Install pnpm with: version: 8 run_install: false - name: Get pnpm store directory shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - uses: actions/cache@v3 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: 📥 Install deps run: pnpm install - name: Set Git version for PRs if: github.event_name == 'pull_request' id: get_version_pr run: | LATEST_TAG=${{ github.ref_name }} LATEST_COMMIT=${{ github.sha }} echo "VITE_LATEST_APP_VERSION=${LATEST_TAG}-${LATEST_COMMIT:0:7}" >> $GITHUB_ENV - name: Set Git version for main branch if: github.event_name == 'push' && github.ref == 'refs/heads/main' id: get_version_main run: | LATEST_TAG=${{ github.ref_name }} echo "VITE_LATEST_APP_VERSION=${LATEST_TAG}" >> $GITHUB_ENV - name: Build Dashboard run: pnpm build --base '/dashboard/' - name: Upload a Build Artifact uses: actions/upload-artifact@v4.2.0 with: name: artifact path: dashboard/dist unit-test: needs: [ lint, build ] env: VITE_BASE_API: /api/ runs-on: ubuntu-latest defaults: run: working-directory: ./dashboard steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 name: Install pnpm with: version: 8 run_install: false - name: Get pnpm store directory shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - uses: actions/cache@v3 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: 📥 Install deps run: pnpm install - name: Build Dashboard run: pnpm test