Merge pull request #38 from atlasconsulting/dependabot/npm_and_yarn/f… #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: [ main, beta, 1.x ] | |
pull_request: | |
branches: [ main, beta, 1.x ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: bedita-sdk | |
path: dist | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
BEDITA_API_KEY: 1234567890 | |
BEDITA_API: http://localhost:8090 | |
BEDITA_ADMIN_USR: admin | |
BEDITA_ADMIN_PWD: admin | |
BEDITA_DOCKER_IMG: bedita/bedita:5 | |
strategy: | |
matrix: | |
node-version: [14, 16, 18] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '${{ matrix.node-version }}' | |
cache: 'yarn' | |
- name: 'Docker pull bedita image' | |
run: 'docker pull ${BEDITA_DOCKER_IMG}' | |
- name: 'Docker inspect bedita image' | |
run: 'docker inspect ${BEDITA_DOCKER_IMG}' | |
- name: 'Docker run bedita image' | |
run: 'docker run --name api -d -p 8090:80 --env BEDITA_API_KEY=${BEDITA_API_KEY} --env BEDITA_ADMIN_USR=${BEDITA_ADMIN_USR} --env BEDITA_ADMIN_PWD=${BEDITA_ADMIN_PWD} ${BEDITA_DOCKER_IMG}' | |
- name: 'Wait for 10' | |
run: 'sleep 10' | |
- name: 'Docker ps - show all containers' | |
run: 'docker ps -a' | |
- name: Install dependencies | |
run: yarn install | |
- name: Linter | |
run: yarn lint | |
- name: Test | |
run: yarn test | |
coverage: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
BEDITA_API_KEY: 1234567890 | |
BEDITA_API: http://localhost:8090 | |
BEDITA_ADMIN_USR: admin | |
BEDITA_ADMIN_PWD: admin | |
BEDITA_DOCKER_IMG: bedita/bedita:5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: 'Docker pull bedita image' | |
run: 'docker pull ${BEDITA_DOCKER_IMG}' | |
- name: 'Docker inspect bedita image' | |
run: 'docker inspect ${BEDITA_DOCKER_IMG}' | |
- name: 'Docker run bedita image' | |
run: 'docker run --name api -d -p 8090:80 --env BEDITA_API_KEY=${BEDITA_API_KEY} --env BEDITA_ADMIN_USR=${BEDITA_ADMIN_USR} --env BEDITA_ADMIN_PWD=${BEDITA_ADMIN_PWD} ${BEDITA_DOCKER_IMG}' | |
- name: 'Wait for 10' | |
run: 'sleep 10' | |
- name: 'Docker ps - show all containers' | |
run: 'docker ps -a' | |
- name: Install dependencies | |
run: yarn install | |
- name: Coverage | |
run: yarn coverage | |
- name: Check test coverage | |
id: test-coverage | |
uses: johanvanhelden/gha-clover-test-coverage-check@v1 | |
with: | |
percentage: '65' | |
filename: './coverage/clover.xml' | |
- name: 'Export coverage results' | |
uses: 'codecov/codecov-action@v3' | |
with: | |
file: './coverage/clover.xml' | |
env_vars: NODE_VERSION | |
- name: 'Archive code coverage results' | |
uses: 'actions/upload-artifact@v3' | |
with: | |
name: 'NODE 18' | |
path: './coverage/clover.xml' | |
release: | |
needs: [test, coverage] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- uses: actions/download-artifact@v3 | |
with: | |
name: bedita-sdk | |
path: dist | |
- uses: cycjimmy/semantic-release-action@v3 | |
with: | |
semantic_version: 19 | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/git | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |