Set default CI working directory

This commit is contained in:
Rodrigo Q. Saramago 2022-09-12 16:45:43 +02:00
parent 3b16174190
commit c8fb2022e1
No known key found for this signature in database
GPG Key ID: 9B36B2525704A359
6 changed files with 32 additions and 11 deletions

View File

@ -6,6 +6,12 @@
# - ubu: ubuntu # - ubu: ubuntu
# - ems: Emscripten # - ems: Emscripten
version: 2.1 version: 2.1
aliases:
- &container_config
# default working_directory for all containers.
working_directory: &working_directory ~/project
parameters: parameters:
ubuntu-2004-docker-image: ubuntu-2004-docker-image:
type: string type: string
@ -288,6 +294,7 @@ defaults:
# Base Image Templates # Base Image Templates
- base_ubuntu1604_clang: &base_ubuntu1604_clang - base_ubuntu1604_clang: &base_ubuntu1604_clang
<<: *container_config
docker: docker:
- image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >> - image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >>
environment: environment:
@ -302,6 +309,7 @@ defaults:
MAKEFLAGS: -j 2 MAKEFLAGS: -j 2
- base_ubuntu2004_clang: &base_ubuntu2004_clang - base_ubuntu2004_clang: &base_ubuntu2004_clang
<<: *container_config
docker: docker:
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
environment: environment:
@ -329,6 +337,7 @@ defaults:
MAKEFLAGS: -j 5 MAKEFLAGS: -j 5
- base_ubuntu2004: &base_ubuntu2004 - base_ubuntu2004: &base_ubuntu2004
<<: *container_config
docker: docker:
- image: << pipeline.parameters.ubuntu-2004-docker-image >> - image: << pipeline.parameters.ubuntu-2004-docker-image >>
environment: environment:
@ -357,6 +366,7 @@ defaults:
MAKEFLAGS: -j 10 MAKEFLAGS: -j 10
- base_buildpack_focal_small: &base_buildpack_focal_small - base_buildpack_focal_small: &base_buildpack_focal_small
<<: *container_config
docker: docker:
- image: buildpack-deps:focal - image: buildpack-deps:focal
resource_class: small resource_class: small
@ -365,6 +375,7 @@ defaults:
MAKEFLAGS: -j 2 MAKEFLAGS: -j 2
- base_buildpack_latest_small: &base_buildpack_latest_small - base_buildpack_latest_small: &base_buildpack_latest_small
<<: *container_config
docker: docker:
- image: buildpack-deps:latest - image: buildpack-deps:latest
resource_class: small resource_class: small
@ -373,6 +384,7 @@ defaults:
MAKEFLAGS: -j 2 MAKEFLAGS: -j 2
- base_archlinux: &base_archlinux - base_archlinux: &base_archlinux
<<: *container_config
docker: docker:
- image: archlinux:base - image: archlinux:base
environment: environment:
@ -380,6 +392,7 @@ defaults:
MAKEFLAGS: -j 3 MAKEFLAGS: -j 3
- base_archlinux_large: &base_archlinux_large - base_archlinux_large: &base_archlinux_large
<<: *container_config
docker: docker:
- image: archlinux:base - image: archlinux:base
resource_class: large resource_class: large
@ -388,22 +401,26 @@ defaults:
MAKEFLAGS: -j 5 MAKEFLAGS: -j 5
- base_win_powershell: &base_win_powershell - base_win_powershell: &base_win_powershell
<<: *container_config
executor: executor:
name: win/default name: win/default
shell: powershell.exe shell: powershell.exe
- base_win_powershell_large: &base_win_powershell_large - base_win_powershell_large: &base_win_powershell_large
<<: *container_config
executor: executor:
name: win/default name: win/default
shell: powershell.exe shell: powershell.exe
size: large size: large
- base_win_cmd: &base_win_cmd - base_win_cmd: &base_win_cmd
<<: *container_config
executor: executor:
name: win/default name: win/default
shell: cmd.exe shell: cmd.exe
- base_osx: &base_osx - base_osx: &base_osx
<<: *container_config
macos: macos:
xcode: "13.2.0" xcode: "13.2.0"
environment: environment:
@ -411,6 +428,7 @@ defaults:
MAKEFLAGS: -j5 MAKEFLAGS: -j5
- base_osx_large: &base_osx_large - base_osx_large: &base_osx_large
<<: *container_config
macos: macos:
xcode: "13.2.0" xcode: "13.2.0"
resource_class: large resource_class: large
@ -419,6 +437,7 @@ defaults:
MAKEFLAGS: -j10 MAKEFLAGS: -j10
- base_ems_large: &base_ems_large - base_ems_large: &base_ems_large
<<: *container_config
docker: docker:
- image: << pipeline.parameters.emscripten-docker-image >> - image: << pipeline.parameters.emscripten-docker-image >>
resource_class: large resource_class: large
@ -427,6 +446,7 @@ defaults:
MAKEFLAGS: -j 5 MAKEFLAGS: -j 5
- base_python_small: &base_python_small - base_python_small: &base_python_small
<<: *container_config
docker: docker:
- image: circleci/python:3.6 - image: circleci/python:3.6
resource_class: small resource_class: small
@ -435,6 +455,7 @@ defaults:
MAKEFLAGS: -j 2 MAKEFLAGS: -j 2
- base_node_small: &base_node_small - base_node_small: &base_node_small
<<: *container_config
docker: docker:
- image: circleci/node - image: circleci/node
resource_class: small resource_class: small

View File

@ -35,7 +35,7 @@ else
fi fi
# solbuildpackpusher/solidity-buildpack-deps:emscripten-13 # solbuildpackpusher/solidity-buildpack-deps:emscripten-13
docker run --volume "$(pwd):/project" --workdir /project \ docker run --volume "$(pwd):${HOME}/project" --workdir "${HOME}/project" \
--user "1000:1000" \ --user "1000:1000" \
solbuildpackpusher/solidity-buildpack-deps@sha256:f1c13f3450d1f2e53ea18ac1ac1a17e932573cb9a5ccd0fd9ef6dd44f6402fa9 \ solbuildpackpusher/solidity-buildpack-deps@sha256:f1c13f3450d1f2e53ea18ac1ac1a17e932573cb9a5ccd0fd9ef6dd44f6402fa9 \
./scripts/ci/build_emscripten.sh "$BUILD_DIR" ./scripts/ci/build_emscripten.sh "$BUILD_DIR"

View File

@ -40,9 +40,9 @@ else
BUILD_DIR="$1" BUILD_DIR="$1"
fi fi
WORKSPACE=/project WORKSPACE="${HOME}/project"
cd $WORKSPACE cd "$WORKSPACE"
# shellcheck disable=SC2166 # shellcheck disable=SC2166
if [[ "$CIRCLE_BRANCH" = release || -n "$CIRCLE_TAG" || -n "$FORCE_RELEASE" || "$(git tag --points-at HEAD 2>/dev/null)" == v* ]] if [[ "$CIRCLE_BRANCH" = release || -n "$CIRCLE_TAG" || -n "$FORCE_RELEASE" || "$(git tag --points-at HEAD 2>/dev/null)" == v* ]]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
ROOTDIR="/project" ROOTDIR="${HOME}/project"
BUILDDIR="${ROOTDIR}/build" BUILDDIR="${ROOTDIR}/build"
mkdir -p "${BUILDDIR}" && mkdir -p "$BUILDDIR/deps" mkdir -p "${BUILDDIR}" && mkdir -p "$BUILDDIR/deps"

View File

@ -56,11 +56,11 @@ echo "-- test_docker @ '${PWD}'"
# See https://github.blog/2022-04-12-git-security-vulnerability-announced/ # See https://github.blog/2022-04-12-git-security-vulnerability-announced/
docker run \ docker run \
--rm \ --rm \
--volume "${PWD}:/project" \ --volume "${PWD}:${HOME}/project" \
"${IMAGE_NAME}" \ "${IMAGE_NAME}" \
bash -c " bash -c "
git config --global --add safe.directory /project && git config --global --add safe.directory ${HOME}/project &&
/project/scripts/ci/${IMAGE_NAME}_test_${IMAGE_VARIANT}.sh ${HOME}/project/scripts/ci/${IMAGE_NAME}_test_${IMAGE_VARIANT}.sh
" "
echo "-- push_docker" echo "-- push_docker"

View File

@ -183,14 +183,14 @@ function process_tag
cd /tmp cd /tmp
echo "Check out solidity repository..." echo "Check out solidity repository..."
if [ -d /project ]; then if [ -d "${HOME}/project" ]; then
echo "Solidity repo checkout already exists." echo "Solidity repo checkout already exists."
else else
git clone "${SOLIDITY_REPO_URL}" /project --quiet git clone "${SOLIDITY_REPO_URL}" "${HOME}/project" --quiet
fi fi
echo "Extract bytecode comparison scripts from v0.6.1..." echo "Extract bytecode comparison scripts from v0.6.1..."
cd /project cd "${HOME}/project"
git checkout v0.6.1 --quiet git checkout v0.6.1 --quiet
cp scripts/bytecodecompare/storebytecode.sh /tmp cp scripts/bytecodecompare/storebytecode.sh /tmp
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,7 +212,7 @@ ln -sf /emsdk_portable/emscripten/sdk/ /emsdk_portable/
ln -sf sdk /emsdk_portable/emscripten/bin ln -sf sdk /emsdk_portable/emscripten/bin
ln -sf /emsdk_portable/emscripten/bin/* /usr/local/bin ln -sf /emsdk_portable/emscripten/bin/* /usr/local/bin
rm -rf /src rm -rf /src
ln -sf /project /src ln -sf "${HOME}/project" /src
echo "Install dependencies and upgrade system packages." echo "Install dependencies and upgrade system packages."
apt-get -qq update >/dev/null 2>&1 apt-get -qq update >/dev/null 2>&1