test: create codecov.yml
configuration file
#11
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: Continous Integration Workflow | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
run-tests-and-collect-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Create testing environment variables files | |
run: echo "${{ secrets.TESTING_ENV_FILE_CONTENT }}" >> .env.test | |
- name: Install dependencies | |
run: bun install | |
- name: Run tests | |
run: bun test --coverage --coverage-reporter=lcov | |
- name: Upload code coverage to Codecov | |
if: github.ref_name == 'main' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/lcov.info | |
build-and-deploy: | |
if: github.ref_name == 'main' | |
needs: run-tests-and-collect-coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Docker Image | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/llms-tdm-server . | |
- name: Log in to Docker hub | |
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Push the Docker Image to Docker hub | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/llms-tdm-server |