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

Run true workaround workaround. #24

Open
wants to merge 2 commits into
base: docker-workflow
Choose a base branch
from
Open
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
19 changes: 2 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,11 @@ defaults:

- run_build: &run_build
name: Build
command: |
set -ex
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi
echo -n "$CIRCLE_SHA1" > commit_hash.txt
mkdir -p build
cd build
[ -n "$COVERAGE" -a "$CIRCLE_BRANCH" != release -a -z "$CIRCLE_TAG" ] && CMAKE_OPTIONS="$CMAKE_OPTIONS -DCOVERAGE=ON"
cmake .. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} $CMAKE_OPTIONS -G "Unix Makefiles"
make -j4
command: scripts/ci/build.sh

- run_build_ossfuzz: &run_build_ossfuzz
name: Build_ossfuzz
command: |
mkdir -p build
cd build
protoc --proto_path=../test/tools/ossfuzz yulProto.proto --cpp_out=../test/tools/ossfuzz
protoc --proto_path=../test/tools/ossfuzz abiV2Proto.proto --cpp_out=../test/tools/ossfuzz
protoc --proto_path=../test/tools/ossfuzz solProto.proto --cpp_out=../test/tools/ossfuzz
cmake .. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} $CMAKE_OPTIONS
make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j4
command: scripts/ci/build_ossfuzz.sh

- run_proofs: &run_proofs
name: Correctness proofs for optimization rules
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/buildpack-deps-emscripten.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: buildpack-deps:emscripten

on:
pull_request:
paths:
- '.github/workflows/buildpack-deps-emscripten.yml'
- 'scripts/docker/buildpack-deps/Dockerfile.emscripten'

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: buildpack-deps
IMAGE_VARIANT: emscripten

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Upgrade ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }}
run: |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin
scripts/ci/docker_upgrade.sh
docker logout docker.pkg.github.com

- name: comment PR
uses: aarlt/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`."
check_for_duplicate_msg: false # OPTIONAL
34 changes: 34 additions & 0 deletions .github/workflows/buildpack-deps-ubuntu1604.clang.ossfuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: buildpack-deps:ubuntu1604.clang.ossfuzz

on:
pull_request:
paths:
- '.github/workflows/buildpack-deps-ubuntu1604.clang.ossfuzz.yml'
- 'scripts/docker/buildpack-deps/Dockerfile.ubuntu1604.clang.ossfuzz'

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: buildpack-deps
IMAGE_VARIANT: ubuntu1604.clang.ossfuzz

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Upgrade ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }}
run: |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin
scripts/ci/docker_upgrade.sh
docker logout docker.pkg.github.com

- name: comment PR
uses: aarlt/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`."
check_for_duplicate_msg: false # OPTIONAL
34 changes: 34 additions & 0 deletions .github/workflows/buildpack-deps-ubuntu1804.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: buildpack-deps:ubuntu1804

on:
pull_request:
paths:
- '.github/workflows/buildpack-deps-ubuntu1804.yml'
- 'scripts/docker/buildpack-deps/Dockerfile.ubuntu1804'

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: buildpack-deps
IMAGE_VARIANT: ubuntu1804

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Upgrade ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }}
run: |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin
scripts/ci/docker_upgrade.sh
docker logout docker.pkg.github.com

- name: comment PR
uses: aarlt/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`."
check_for_duplicate_msg: false # OPTIONAL
36 changes: 36 additions & 0 deletions .github/workflows/buildpack-deps-ubuntu2004.clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: buildpack-deps:ubuntu2004.clang

on:
pull_request:
paths:
- '.github/workflows/buildpack-deps-ubuntu2004.clang.yml'
- 'scripts/docker/buildpack-deps/Dockerfile.ubuntu2004.clang'

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: buildpack-deps
IMAGE_VARIANT: ubuntu2004.clang
CC: clang
CXX: clang++

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Upgrade ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }}
run: |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin
scripts/ci/docker_upgrade.sh
docker logout docker.pkg.github.com

- name: comment PR
uses: aarlt/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`."
check_for_duplicate_msg: false # OPTIONAL
33 changes: 33 additions & 0 deletions .github/workflows/buildpack-deps-ubuntu2004.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: buildpack-deps:ubuntu2004

on:
pull_request:
paths:
- '.github/workflows/buildpack-deps-ubuntu2004.yml'
- 'scripts/docker/buildpack-deps/Dockerfile.ubuntu2004'
jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: buildpack-deps
IMAGE_VARIANT: ubuntu2004

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Upgrade ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VARIANT }}
run: |
echo "${GITHUB_TOKEN}" | docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password-stdin
scripts/ci/docker_upgrade.sh
docker logout docker.pkg.github.com

- name: comment PR
uses: aarlt/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "`${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_REPO_DIGEST }}`."
check_for_duplicate_msg: false # OPTIONAL
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ prerelease.txt

# Build directory
build/
build*/
/build*/
emscripten_build/
docs/_build
__pycache__
Expand Down
22 changes: 22 additions & 0 deletions scripts/ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -ex

ROOTDIR="$(dirname "$0")/../.."
cd "${ROOTDIR}"

# shellcheck disable=SC2166
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" >prerelease.txt; fi
if [ -n "$CIRCLE_SHA1" ]
then
echo -n "$CIRCLE_SHA1" >commit_hash.txt
fi

mkdir -p build
cd build

# shellcheck disable=SC2166
[ -n "$COVERAGE" -a "$CIRCLE_BRANCH" != release -a -z "$CIRCLE_TAG" ] && CMAKE_OPTIONS="$CMAKE_OPTIONS -DCOVERAGE=ON"

# shellcheck disable=SC2086
cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS -G "Unix Makefiles"
make -j4
14 changes: 14 additions & 0 deletions scripts/ci/build_ossfuzz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e

ROOTDIR="$(dirname "$0")/../.."
BUILDDIR="${ROOTDIR}/build"

mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"

protoc --proto_path=../test/tools/ossfuzz yulProto.proto --cpp_out=../test/tools/ossfuzz
protoc --proto_path=../test/tools/ossfuzz abiV2Proto.proto --cpp_out=../test/tools/ossfuzz
protoc --proto_path=../test/tools/ossfuzz solProto.proto --cpp_out=../test/tools/ossfuzz
cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/libfuzzer.cmake
make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j4
1 change: 1 addition & 0 deletions scripts/ci/buildpack-deps_test_emscripten.sh
1 change: 1 addition & 0 deletions scripts/ci/buildpack-deps_test_ubuntu1604.clang.ossfuzz.sh
1 change: 1 addition & 0 deletions scripts/ci/buildpack-deps_test_ubuntu1804.sh
1 change: 1 addition & 0 deletions scripts/ci/buildpack-deps_test_ubuntu2004.clang.sh
1 change: 1 addition & 0 deletions scripts/ci/buildpack-deps_test_ubuntu2004.sh
81 changes: 81 additions & 0 deletions scripts/ci/docker_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
set -e

check_parameters() {
echo "-- check_parameters"

if [ -z "${IMAGE_NAME}" ] || [ -z "${IMAGE_VARIANT}" ] || [ -z "${DOCKER_REPOSITORY}" ]; then
echo "\${IMAGE_NAME}, \${IMAGE_VARIANT} and \${DOCKER_REPOSITORY} need to be defined."

false
fi
}

check_version() {
echo "-- check_version"

git fetch
git branch
DOCKERFILE="scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}"
PREV_VERSION=$(git diff origin/develop HEAD -- "${DOCKERFILE}" | grep -e "-LABEL version=\".*\"" | awk -F"\"" '{ print $2 }')
NEXT_VERSION=$(git diff origin/develop HEAD -- "${DOCKERFILE}" | grep -e "+LABEL version=\".*\"" | awk -F"\"" '{ print $2 }')

if [ -z "${NEXT_VERSION}" ]; then
echo ""
echo "ERROR: No version label defined in Dockerfile. You may need to add 'LABEL version' in '${DOCKERFILE}'. Aborting."
echo ""

false
fi

if [ -z "${PREV_VERSION}" ]; then
PREV_VERSION=0
echo ""
echo "WARNING: no previous version found. Will set \$PREV_VERSION = 0."
echo ""
fi

if [[ $((PREV_VERSION + 1)) != $((NEXT_VERSION)) ]]; then
echo ""
echo "ERROR: Version label in Dockerfile was not incremented. You may need to change 'LABEL version' in '${DOCKERFILE}'. Aborting."
echo ""

false
fi
}

build_docker() {
echo "-- build_docker"

docker build "scripts/docker/${IMAGE_NAME}" --file "scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}" --tag "${IMAGE_NAME}" || docker build "scripts/docker/${IMAGE_NAME}" --file "scripts/docker/${IMAGE_NAME}/Dockerfile.${IMAGE_VARIANT}" --tag "${IMAGE_NAME}"
}

test_docker() {
echo "-- test_docker @ '${PWD}'"

docker run -v "${PWD}:/root/project" "${IMAGE_NAME}" "/root/project/scripts/ci/${IMAGE_NAME}_test_${IMAGE_VARIANT}.sh"
}

push_docker() {
echo "-- push_docker"

VERSION=$(docker inspect --format='{{.Config.Labels.version}}' "${IMAGE_NAME}")
DOCKER_IMAGE_ID="${DOCKER_REPOSITORY}/${IMAGE_NAME}-${IMAGE_VARIANT}"

docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:${VERSION}"
docker push "${DOCKER_IMAGE_ID}:${VERSION}"

REPO_DIGEST=$(docker inspect --format='{{.RepoDigests}}' "${DOCKER_IMAGE_ID}:${VERSION}")

docker tag "${IMAGE_NAME}" "${DOCKER_IMAGE_ID}:latest"
docker push "${DOCKER_IMAGE_ID}:latest"

echo "::set-env name=DOCKER_IMAGE::${DOCKER_IMAGE_ID}:${VERSION}"
echo "::set-env name=DOCKER_REPO_DIGEST::${REPO_DIGEST}"
}

check_parameters
check_version
build_docker
test_docker
push_docker
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# make version=1.39.15 build
#
FROM emscripten/emsdk:1.39.15 AS base
LABEL version="1"

ADD emscripten.jam /usr/src
RUN set -ex; \
Expand Down Expand Up @@ -63,3 +64,4 @@ RUN set -ex; \
cxxflags="-s DISABLE_EXCEPTION_CATCHING=0 -Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
--prefix=/emsdk/emscripten/sdk/system install; \
rm -r /usr/src/boost_1_73_0

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# (c) 2016-2019 solidity contributors.
#------------------------------------------------------------------------------
FROM gcr.io/oss-fuzz-base/base-clang as base
LABEL version="1"

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -99,3 +100,4 @@ FROM base
COPY --from=libraries /usr/lib /usr/lib
COPY --from=libraries /usr/bin /usr/bin
COPY --from=libraries /usr/include /usr/include

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# (c) 2016-2019 solidity contributors.
#------------------------------------------------------------------------------
FROM buildpack-deps:bionic AS base
LABEL version="1"

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -91,3 +92,4 @@ FROM base
COPY --from=libraries /usr/lib /usr/lib
COPY --from=libraries /usr/bin /usr/bin
COPY --from=libraries /usr/include /usr/include

Loading