gitscope
← marzneshin / v0.3.0 / .github/workflows/dashboard-ci.yml
https://dev.kronoz.win/r/marzneshin.git
.github/workflows/dashboard-ci.yml · YAML
Blame Raw
  1name: Dashboard CI
  2
  3on:
  4  push:
  5    branches: [ "master" ]
  6  pull_request:
  7
  8jobs:
  9  lint:
 10    env: 
 11      VITE_BASE_API: /api/
 12    runs-on: ubuntu-latest
 13    defaults:
 14      run:
 15        working-directory: ./dashboard
 16    steps:
 17      - uses: actions/checkout@v4
 18
 19      - uses: pnpm/action-setup@v3
 20        name: Install pnpm
 21        with:
 22          version: 8
 23          run_install: false
 24      - name: Get pnpm store directory
 25        shell: bash
 26        run: |
 27          echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV          
 28
 29      - uses: actions/cache@v3
 30        name: Setup pnpm cache
 31        with:
 32          path: ${{ env.STORE_PATH }}
 33          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
 34          restore-keys: |
 35            ${{ runner.os }}-pnpm-store-            
 36
 37      - name: 📥 Install deps
 38        run: pnpm install
 39
 40      - name: Lint Dashboard
 41        run: pnpm lint
 42
 43  build:
 44    needs: [lint]
 45    env: 
 46      VITE_BASE_API: /api/
 47    runs-on: ubuntu-latest
 48    defaults:
 49      run:
 50        working-directory: ./dashboard
 51    steps:
 52      - uses: actions/checkout@v4
 53
 54      - uses: pnpm/action-setup@v3
 55        name: Install pnpm
 56        with:
 57          version: 8
 58          run_install: false
 59      - name: Get pnpm store directory
 60        shell: bash
 61        run: |
 62          echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV          
 63
 64      - uses: actions/cache@v3
 65        name: Setup pnpm cache
 66        with:
 67          path: ${{ env.STORE_PATH }}
 68          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
 69          restore-keys: |
 70            ${{ runner.os }}-pnpm-store-            
 71
 72      - name: 📥 Install deps
 73        run: pnpm install
 74
 75      - name: Build Dashboard
 76        run: pnpm build --base '/dashboard/'
 77      
 78      - name: Upload a Build Artifact
 79        uses: actions/upload-artifact@v4.2.0
 80        with:
 81          name: artifact
 82          path: dashboard/dist
 83
 84  unit-test:
 85    needs: [lint, build]
 86    env: 
 87      VITE_BASE_API: /api/
 88    runs-on: ubuntu-latest
 89    defaults:
 90      run:
 91        working-directory: ./dashboard
 92    steps:
 93      - uses: actions/checkout@v4
 94
 95      - uses: pnpm/action-setup@v3
 96        name: Install pnpm
 97        with:
 98          version: 8
 99          run_install: false
100      - name: Get pnpm store directory
101        shell: bash
102        run: |
103          echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV          
104
105      - uses: actions/cache@v3
106        name: Setup pnpm cache
107        with:
108          path: ${{ env.STORE_PATH }}
109          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
110          restore-keys: |
111            ${{ runner.os }}-pnpm-store-            
112
113      - name: 📥 Install deps
114        run: pnpm install
115
116      - name: Build Dashboard
117        run: pnpm test