Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Maskwalk brranch from drag-race #986

Merged
merged 14 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ on:
pull_request:
branches: ["**"]
workflow_dispatch:
branches: ["**"]

jobs:
collect-solutions:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Find Dockerfiles"
id: "solutions"
Expand All @@ -31,10 +30,10 @@ jobs:
solutions: ${{ steps.solutions.outputs.solutions }}

build:
env:
env:
ENABLE_DOCKER_PUSH: ${{ github.repository_owner == 'PlummersSoftwareLLC' && github.ref == 'refs/heads/drag-race' }}

runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"

needs: ["collect-solutions"]

Expand All @@ -45,7 +44,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Normalize solution name"
id: solution-name
Expand Down Expand Up @@ -76,32 +75,32 @@ jobs:
config_file: ./config/hadolint.yml

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: ${{ env.ENABLE_DOCKER_PUSH == 'true' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build amd64
if: steps.arch-amd64.outputs.build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
tags: primeimages/primes:${{ steps.solution-name.outputs.normalized }}
context: ${{ matrix.solution }}
platforms: linux/amd64
push: ${{ env.ENABLE_DOCKER_PUSH }}
cache-from: type=registry,ref=primeimages/primes:${{ steps.solution-name.outputs.normalized }}
cache-to: type=inline

- name: Build arm64
if: steps.arch-arm64.outputs.build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
tags: primeimages/primes:${{ steps.solution-name.outputs.normalized }}
context: ${{ matrix.solution }}
Expand Down
11 changes: 11 additions & 0 deletions BENCHMARK.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Some solutions are not included in the automated benchmark runs, either because
- [Running a benchmark of all solutions for a particular language](#running-a-benchmark-of-all-solutions-for-a-particular-language)
- [Running in unconfined mode](#running-in-unconfined-mode)
- [Output formats](#output-formats)
- [Setting the solution timeout](#setting-the-solution-timeout)

## What operating system to use?

Expand Down Expand Up @@ -375,3 +376,13 @@ The output format can be controlled via the `FORMATTER` variable like this:
make FORMATTER=json
make DIRECTORY=PrimeCrystal/solution_1 FORMATTER=csv
```

## Setting the solution timeout

The run of each solution is limited to a certain duration, which is 10 minutes by default.
You can change this setting through the `TIMEOUT` variable like this:

```shell
make TIMEOUT=15
make DIRECTORY=PrimeCPP/solution_2 TIMEOUT=15
```
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SHELL := /bin/bash

DIRECTORY := $(shell pwd)
FORMATTER := "table"
TIMEOUT := "10"

.PHONY: all
all: benchmark
Expand All @@ -14,6 +15,7 @@ benchmark: check-env
ARGS=("-d $${REALPATH}" "-f $(FORMATTER)"); \
[ ! -z $${OUTPUT_FILE} ] && ARGS+=( "-o $${OUTPUT_FILE}" ); \
[ ! -z $${UNCONFINED} ] && ARGS+=( "--unconfined" ); \
[ ! -z $${TIMEOUT} ] && ARGS+=( "-t $${TIMEOUT}" ); \
cd ./tools; npm ci --silent && npm start --silent -- benchmark $${ARGS[@]}

.PHONY: check-env
Expand Down
24 changes: 6 additions & 18 deletions PrimeBrainFuck/solution_1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# container for building
FROM ubuntu:18.04 AS build
FROM ubuntu:22.04 AS build

# install tools
RUN apt-get update \
&& apt-get install -y lsb-release wget software-properties-common git

# install clang-12 for C++ standard 17
RUN wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 12
&& apt-get install -y lsb-release wget software-properties-common git clang cmake

# set clang as default compiler for C and C++
ENV CC=/usr/bin/clang-12 \
CXX=/usr/bin/clang++-12

# install latest version of cmake
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - \
&& apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' \
&& apt-get update \
&& apt-get install -y cmake
ENV CC=/usr/bin/clang \
CXX=/usr/bin/clang++

# clone custom language interpreter
RUN git clone https://github.com/ThatAquarel/BrainF-ck-Interpreter \
Expand All @@ -34,10 +22,10 @@ RUN cmake -DCMAKE_BUILD_TYPE=Release .. \
# build prime sieve caller
WORKDIR /opt/app/
COPY *.cpp *.b ./
RUN clang++-12 -Ofast -std=c++17 PrimeBrainFuck.cpp -oPrimeBrainFuck
RUN clang++ -Ofast -std=c++17 PrimeBrainFuck.cpp -oPrimeBrainFuck

# container for running built binaries
FROM ubuntu:18.04
FROM ubuntu:22.04

# copy binaries from build container to current
COPY --from=build /BrainF-ck-Interpreter/release/brainfuck /usr/local/bin
Expand Down
Loading