maingockien01 is running CI on commit 5c182c1e0c86f3c90b559fd2974eadfefe74576f #24
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 }} | |
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: | |
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: | |
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: | |
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 | |
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:unit |