Last active
November 17, 2019 07:14
-
-
Save Roms1383/98ff2ab9cb3ac03d30870e0fe35c5bd8 to your computer and use it in GitHub Desktop.
Integration tests of a MESG Service on GitHub Actions ✅
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: build | |
on: [push] | |
env: | |
NPM: '6.12.0' | |
YARN: '1.19.1' | |
CI: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use NVM | |
uses: dcodeIO/setup-node-nvm@master | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Upgrade NPM and Yarn | |
run: | | |
npm i -g npm@$NPM | |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN | |
export PATH="$HOME/.yarn/bin:$PATH" | |
- name: Lint files | |
run: | | |
yarn | |
yarn lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use NVM | |
uses: dcodeIO/setup-node-nvm@master | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Upgrade NPM and Yarn | |
run: | | |
npm i -g npm@$NPM | |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN | |
export PATH="$HOME/.yarn/bin:$PATH" | |
- name: Unit test | |
run: | | |
npm install -g codacy-coverage | |
yarn | |
yarn spec --coverage | |
yarn coverage | |
env: | |
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }} | |
PUSHER_APP_KEY: ${{ secrets.PUSHER_APP_KEY }} | |
PUSHER_APP_SECRET: ${{ secrets.PUSHER_APP_SECRET }} | |
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }} | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
- name: Integration test | |
run: | | |
npm install -g mesg-cli | |
yarn | |
docker swarm init | |
yarn test | |
env: | |
MESG_ACCOUNT: ${{ secrets.MESG_ACCOUNT }} | |
MESG_PASSPHRASE: ${{ secrets.MESG_PASSPHRASE }} | |
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }} | |
PUSHER_APP_KEY: ${{ secrets.PUSHER_APP_KEY }} | |
PUSHER_APP_SECRET: ${{ secrets.PUSHER_APP_SECRET }} | |
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }} | |
release: | |
name: Release | |
if: github.ref == 'refs/heads/master' | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use NVM | |
uses: dcodeIO/setup-node-nvm@master | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Upgrade NPM and Yarn | |
run: | | |
npm i -g npm@$NPM | |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN | |
export PATH="$HOME/.yarn/bin:$PATH" | |
- name: Publish release | |
run: | | |
yarn | |
yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment