maingockien01 is running CI on commit f3fb8abd3c3f37819276f338232586e324face3e for branch refs/pull/62/merge #108
Workflow file for this run
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: CI | |
run-name: ${{ github.actor }} is running ${{ github.workflow }} on commit ${{ github.sha }} for branch ${{ github.ref }} | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
DOCKER_TAG: ${{ secrets.DOCKER_USERNAME }}/team8:${{ github.sha }} | |
IS_PUSH_TO_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
jobs: | |
build: | |
name: Build and push Docker image | |
runs-on: ubuntu-latest | |
concurrency: | |
group: build-${{ github.sha }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
if: ${{ env.IS_PUSH_TO_MAIN }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ env.DOCKER_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.DOCKER_TAG }} | |
cache-from: type=registry,ref=${{ env.DOCKER_TAG }} | |
cache-to: type=inline | |
lint: | |
name: Lint code - Code style check | |
runs-on: ubuntu-latest | |
needs: build | |
concurrency: | |
group: lint-${{ github.sha }} | |
cancel-in-progress: true | |
steps: | |
- name: Run linter on workspace backend | |
id: backend | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend lint | |
- name: Run linter on workspace frontend | |
id: frontend | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/frontend lint | |
- name: Run linter on workspace types | |
id: types | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/types lint | |
- name: Run linter on workspace constants | |
id: constants | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/constants lint | |
- name: Run linter on workspace utils | |
id: utils | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/utils lint | |
tests-unit-backend: | |
name: Run unit tests on workspace backend | |
runs-on: ubuntu-latest | |
needs: build | |
concurrency: | |
group: tests-unit-backend-${{ github.sha }} | |
cancel-in-progress: true | |
steps: | |
- name: Run unit tests on workspace backend | |
id: backend-unit | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:unit | |
tests-unit-frontend: | |
name: Run unit tests on workspace frontend | |
runs-on: ubuntu-latest | |
needs: build | |
concurrency: | |
group: tests-unit-frontend-${{ github.sha }} | |
cancel-in-progress: true | |
steps: | |
- name: Run unit tests on workspace frontend | |
id: frontend-unit | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/frontend test:unit | |
tests-backend-e2e: | |
name: Run integration tests on workspace backend | |
runs-on: ubuntu-latest | |
needs: build | |
concurrency: | |
group: tests-backend-e2e-${{ github.sha }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Run e2e tests on workspace backend | |
id: backend-e2e | |
run: | | |
docker network create team8 && \ | |
docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root --name database mysql:5.7 -v ./docker/mysql/provision/init.sql:/docker-entrypoint-initdb.d/init.sql --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --health-start-period=10s --network=team8 && \ | |
docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:e2e --network=team8 |