|
| 1 | +name: Create tagged release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v*.*.* |
| 6 | + |
| 7 | +jobs: |
| 8 | + sonar: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Set up Git repository |
| 12 | + uses: actions/checkout@v2 |
| 13 | + - name: Set up node |
| 14 | + uses: actions/setup-node@v2 |
| 15 | + with: |
| 16 | + node-version: 14 |
| 17 | + - name: Setup sonarqube |
| 18 | + uses: warchant/setup-sonar-scanner@v3 |
| 19 | + - name: Setup Docker |
| 20 | + run: | |
| 21 | + docker pull s1hofmann/nut-ci:latest |
| 22 | + docker run -it -d --name nut-ci --shm-size 4gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash |
| 23 | + - name: Install |
| 24 | + run: npm ci |
| 25 | + - name: Compile |
| 26 | + run: npm run compile |
| 27 | + - name: Init e2e test subpackage |
| 28 | + run: npm --prefix e2e/tests ci |
| 29 | + - name: Clean coverage report |
| 30 | + run: npm run coverage:clean |
| 31 | + - name: Generate coverage report |
| 32 | + uses: GabrielBB/xvfb-action@v1 |
| 33 | + with: |
| 34 | + run: npm run coverage -- --coverageDirectory=coverage/unit |
| 35 | + - name: Run Docker E2E tests |
| 36 | + run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14" |
| 37 | + - name: Merge coverage reports |
| 38 | + run: | |
| 39 | + npm run coverage:merge |
| 40 | + npm run coverage:merge-report |
| 41 | + - name: Run sonarqube |
| 42 | + env: |
| 43 | + # to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + run: sonar-scanner |
| 46 | + -Dsonar.login=${{ secrets.SONAR_TOKEN }} |
| 47 | + -Dsonar.organization=nut-tree |
| 48 | + -Dsonar.host.url=https://sonarcloud.io/ |
| 49 | + -Dsonar.projectKey=nut-tree:nut.js |
| 50 | + |
| 51 | + test: |
| 52 | + needs: |
| 53 | + - sonar |
| 54 | + strategy: |
| 55 | + matrix: |
| 56 | + os: [ ubuntu-latest, windows-latest, macos-latest ] |
| 57 | + node: [ 10, 11, 12, 13, 14 ] |
| 58 | + exclude: |
| 59 | + - os: ubuntu-latest |
| 60 | + node: 14 |
| 61 | + runs-on: ${{matrix.os}} |
| 62 | + steps: |
| 63 | + - name: Set up Git repository |
| 64 | + uses: actions/checkout@v2 |
| 65 | + - name: Set up node |
| 66 | + uses: actions/setup-node@v2 |
| 67 | + with: |
| 68 | + node-version: 14 |
| 69 | + - name: Setup Docker |
| 70 | + if: ${{matrix.os == 'ubuntu-latest'}} |
| 71 | + run: | |
| 72 | + docker pull s1hofmann/nut-ci:latest |
| 73 | + docker run -it -d --name nut-ci --shm-size 4gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash |
| 74 | + - name: Install |
| 75 | + run: npm ci |
| 76 | + - name: Compile |
| 77 | + run: npm run compile |
| 78 | + - name: Init e2e test subpackage |
| 79 | + run: npm --prefix e2e/tests ci |
| 80 | + - name: Generate coverage report |
| 81 | + uses: GabrielBB/xvfb-action@v1 |
| 82 | + with: |
| 83 | + run: npm run coverage -- --coverageDirectory=coverage/unit |
| 84 | + - name: Run Docker E2E tests |
| 85 | + if: ${{matrix.os == 'ubuntu-latest'}} |
| 86 | + run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14" |
| 87 | + |
| 88 | + deploy: |
| 89 | + needs: |
| 90 | + - sonar |
| 91 | + - test |
| 92 | + runs-on: ubuntu-latest |
| 93 | + steps: |
| 94 | + - name: Set up Git repository |
| 95 | + uses: actions/checkout@v2 |
| 96 | + - name: Set up node |
| 97 | + uses: actions/setup-node@v2 |
| 98 | + with: |
| 99 | + node-version: 14 |
| 100 | + - name: Publish tagged release |
| 101 | + uses: JS-DevTools/npm-publish@v1 |
| 102 | + with: |
| 103 | + token: ${{ secrets.NPM_TOKEN }} |
0 commit comments