.github/workflows/ci.yml
name: CI on: push jobs: prettify: runs-on: ubuntu-latest env: SECRETS_AVAILABLE: ${{ secrets.CI_PERSONAL_TOKEN != '' }} steps: - uses: actions/checkout@v2 with: token: ${{ secrets.CI_PERSONAL_TOKEN || github.token }} - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v4 if: ${{ env.SECRETS_AVAILABLE == 'true' }} with: gpg_private_key: ${{ secrets.PRIVATE_KEY_CI }} passphrase: ${{ secrets.PASSWORD_KEY_CI }} git_user_signingkey: true git_commit_gpgsign: true - name: Setup Node.js uses: actions/setup-node@v2 if: ${{ env.SECRETS_AVAILABLE == 'true' }} with: node-version: "14" - name: Install prettier if: ${{ env.SECRETS_AVAILABLE == 'true' }} run: npm install --no-save "prettier@$(node -p -e "require('./package.json').devDependencies.prettier")" - name: Run prettier if: ${{ env.SECRETS_AVAILABLE == 'true' }} run: npx prettier --write . - name: Commit changes if: ${{ env.SECRETS_AVAILABLE == 'true' }} run: | git config --global user.name 'robotcoralci' git config --global user.email 'robotcoralci@users.noreply.github.com' git add -A if [ "$(git diff --name-only --cached)" ]; then git commit -S -m "chore: run Prettier"; fi git push run-angular-tests: runs-on: ubuntu-latest needs: [prettify] steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x uses: actions/setup-node@v1 with: node-version: 14.x - name: Setup run: npm ci --no-optional --debug - name: Build run: npm run build - name: Test run: | npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI