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: C++ Build (Сборка проекта) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Docker cache digest | |
id: get-cache-digest | |
run: echo "::set-output name=digest::$(sha256sum docker-compose.yml | awk '{ print $1 }')" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
id: cache-docker-layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-docker-${{ steps.get-cache-digest.outputs.digest }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
- name: Run docker-compose | |
uses: hoverkraft-tech/[email protected] | |
with: | |
compose-file: "docker-compose.yml" | |
- name: Build and Run Docker Containers | |
run: | | |
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max . | |
docker compose up --abort-on-container-exit --exit-code-from bmstu | |
- name: Save Docker layer cache | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docker-layer-cache | |
path: /tmp/.buildx-cache |