ci: updated workflow to build before test #195
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: Continuous Integration Workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: [push] | |
env: | |
CI: true | |
DISPLAY: ':99.0' | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | |
COVERALLS_GIT_BRANCH: master | |
jobs: | |
send_docker_image_to_hub: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: login to docker hub | |
id: docker-hub | |
env: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
run: | | |
docker logout | |
docker login -u $username -p $password docker.io | |
- name: Build Docker Image | |
run: | | |
cd cli && docker build -t ${{secrets.DOCKERHUB_USERNAME}}/smelly-test . | |
- name: Push Docker Image | |
run: | | |
docker push ${{secrets.DOCKERHUB_USERNAME}}/smelly-test:latest | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Environment Variables | |
uses: tw3lveparsecs/[email protected] | |
with: | |
envFilePath: ./envvars.for.actions | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: export display | |
run: | | |
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | |
echo ">>> Started xvfb" | |
- name: Load & Cache Dependencies | |
uses: ./.github/actions/cached-deps | |
- name: npm build | |
run: | | |
npm run build | |
- name: npm build vscode | |
run: | | |
npm run vscode:prepublish --workspace=vscode | |
- name: npm package standalone extension | |
if: github.ref == 'refs/heads/main' | |
run: | | |
npm i -g vsce | |
npm run generate:vsix --workspace=vscode | |
- name: store artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: smelly-test-vscode-extension | |
path: ./vscode/*.vsix | |
test: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Environment Variables | |
uses: tw3lveparsecs/[email protected] | |
with: | |
envFilePath: ./envvars.for.actions | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Load & Cache Dependencies | |
uses: ./.github/actions/cached-deps | |
- name: npm test | |
if: github.ref != 'refs/heads/main' | |
run: | | |
npm run build | |
npm run test | |
- name: npm coverage | |
if: github.ref == 'refs/heads/main' | |
#npm run coveralls --workspace=vscode | |
run: | | |
npm run test | |