Use CMakeLists.txt instead of Makefile #28
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: Docker Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache build directory | |
uses: actions/cache@v3 | |
with: | |
path: build | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
- name: Set lowercase repository owner | |
id: repo_owner | |
run: echo "::set-output name=owner::${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]' | |
- name: Build Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
tags: ghcr.io/${{ steps.repo_owner.outputs.owner }}/build_test:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
BUILDKIT_INLINE_CACHE=1 | |
- name: Extract build directory from Docker image | |
run: | | |
container_id=$(docker create ghcr.io/${{ steps.repo_owner.outputs.owner }}/build_test:latest) | |
docker cp $container_id:/rawhash2/build ./build | |
docker rm $container_id | |
- name: Run Docker container | |
run: docker run --rm ghcr.io/${{ steps.repo_owner.outputs.owner }}/build_test:latest -h |