Skip to content

ci: fix

ci: fix #5

Workflow file for this run

name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build artifacts
run: ./scripts/ci/build-artifacts.sh
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Comment on github
run: node ./scripts/azure/github-comment.js "[Preview Preparing...](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: ${{ secrets.ACCESS_REPO }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Build site
run: yarn run site:build
- name: 'Deploy Site'
run: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
echo "Deploy to $DEPLOY_DOMAIN"
cp ./src/dist/browser/index.html ./src/dist/browser/404.html
npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
SURGE_LOGIN: $(SURGE_LOGIN)
SURGE_TOKEN: $(SURGE_TOKEN)
- name: 'Update comment on github'
run: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
node ./scripts/azure/github-comment.js "[Preview is ready!]($DEPLOY_DOMAIN)"
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
- name: 'When failed'
if: failure()
run: node ./scripts/azure/github-comment.js "[Preview Build Failed!](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})"
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Test
run: yarn run test
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/
files: cobertura-coverage.xml
fail_ci_if_error: true
verbose: true
test-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Test
run: yarn run test:cli
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Check code lint
run: yarn run lint