diff --git a/.github/actions/cache/action.yaml b/.github/actions/cache/action.yaml new file mode 100644 index 0000000000..1ff215d738 --- /dev/null +++ b/.github/actions/cache/action.yaml @@ -0,0 +1,16 @@ +name: Node modules cache +description: Retrieve and cache project node_modules +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # cache node modules for all jobs to use + - uses: actions/cache@v4 + id: node_modules-cache + with: + path: | + **/node_modules + key: install-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} diff --git a/.github/actions/cypress-cache/action.yaml b/.github/actions/cypress-cache/action.yaml new file mode 100644 index 0000000000..9672ae70cd --- /dev/null +++ b/.github/actions/cypress-cache/action.yaml @@ -0,0 +1,11 @@ +name: Cypress runner cache +description: Retrieve and cache the cypress runner +runs: + using: "composite" + steps: + # cache cypress runner + - uses: actions/cache@v4 + id: cypress-cache + with: + path: /home/runner/.cache/Cypress + key: cypress-runner-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..1cbdbf7db3 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,73 @@ +name: Frontend components CI pipeline +on: + pull_request: + branches: + - master + - nx + push: + branches: + - master + - nx + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: nrwl/nx-set-shas@v4 + - uses: './.github/actions/cache' + - uses: './.github/actions/cypress-cache' + - name: Install dependencies + run: npm i + build: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: nrwl/nx-set-shas@v4 + - uses: './.github/actions/cache' + - name: Build + run: npx nx affected -t build --exclude=demo + unit-test: + runs-on: ubuntu-latest + needs: [install, build] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: nrwl/nx-set-shas@v4 + - uses: './.github/actions/cache' + - name: Run unit tests + run: npx nx affected -t test:unit --exclude=demo + component-test: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: nrwl/nx-set-shas@v4 + - uses: './.github/actions/cache' + - uses: './.github/actions/cypress-cache' + - name: Run component tests + run: npx nx affected -t test:component --exclude=demo --configuration=ci + lint: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: nrwl/nx-set-shas@v4 + - uses: './.github/actions/cache' + - name: Lint + run: npx nx affected -t test:lint --exclude=demo