diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile deleted file mode 100644 index 96e63356a2..0000000000 --- a/.circleci/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM cimg/node:16.20.1 - -ENV SHELL="/bin/bash" - -ADD ./install-foundry.sh /install-foundry.sh -RUN /install-foundry.sh - -ADD ./install-ipfs.sh /install-ipfs.sh -RUN /install-ipfs.sh diff --git a/.circleci/README.md b/.circleci/README.md deleted file mode 100644 index 351e8d7d48..0000000000 --- a/.circleci/README.md +++ /dev/null @@ -1,5 +0,0 @@ -```sh -docker login -u noisekit -docker build . -t noisekit/synthetix-cci:node-16.20.1 -docker push noisekit/synthetix-cci:node-16.20.1 -``` diff --git a/.circleci/config.yml b/.circleci/config.yml index d5decdd5af..5454753a45 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,10 +1,75 @@ version: 2.1 +parameters: + node-version: + type: string + default: "16.20.1" + commands: yarn-install: steps: - run: yarn install --immutable --immutable-cache + install-foundry: + steps: + - restore_cache: + keys: + - foundry-{{ .Environment.FOUNDRY_CACHE_VERSION }} + + - run: + name: "Install Foundry" + working_directory: ~/ + environment: + SHELL: /bin/bash + command: |- + if [ command -v anvil ]; then + echo "Anvil already installed" + anvil --version + else + curl -L https://foundry.paradigm.xyz | bash + export PATH="$PATH:$HOME/.foundry/bin" + echo 'export PATH=$PATH:$HOME/.foundry/bin' >> $BASH_ENV + foundryup + fi + + - save_cache: + key: foundry-{{ .Environment.CACHE_VERSION }} + paths: + - "~/.foundry" + + install-ipfs: + steps: + - restore_cache: + keys: + - ipfs-{{ .Environment.IPFS_CACHE_VERSION }} + + - run: + name: "Install IPFS" + working_directory: ~/ + command: | + if [ command -v ipfs ]; then + echo "IPFS already installed" + ipfs version + ipfs id + else + rm -rf ~/.ipfs + LATEST_VERSION=$(curl -sSL https://dist.ipfs.tech/go-ipfs/versions | tail -n 1) + LATEST_VERSION_NUMBER=${LATEST_VERSION#*v} + DOWNLOAD_URL="https://dist.ipfs.tech/go-ipfs/${LATEST_VERSION}/go-ipfs_${LATEST_VERSION}_linux-amd64.tar.gz" + echo "DOWNLOAD_URL=$DOWNLOAD_URL" + curl -sSL -o ipfs.tar.gz $DOWNLOAD_URL + tar -xzf ipfs.tar.gz + export PATH="$PATH:$HOME/go-ipfs" + echo 'export PATH=$PATH:$HOME/go-ipfs' >> $BASH_ENV + ipfs init + fi + + - save_cache: + key: ipfs-{{ .Environment.CACHE_VERSION }} + paths: + - "~/go-ipfs" + - "~/.ipfs" + run-ipfs-daemon: steps: - run: @@ -20,10 +85,11 @@ commands: jobs: build-testable: docker: - - image: noisekit/synthetix-cci:node-16.20.1 + - image: cimg/node:<< pipeline.parameters.node-version >> steps: - - run: echo export PATH="$PATH:$HOME/.foundry/bin:$HOME/go-ipfs" > $BASH_ENV - checkout + - install-foundry + - install-ipfs - run-ipfs-daemon - yarn-install - run: yarn workspaces foreach --topological-dev --verbose run build:ts @@ -44,11 +110,12 @@ jobs: workspace: type: string docker: - - image: noisekit/synthetix-cci:node-16.20.1 + - image: cimg/node:<< pipeline.parameters.node-version >> parallelism: 2 steps: - - run: echo export PATH="$PATH:$HOME/.foundry/bin:$HOME/go-ipfs" > $BASH_ENV - checkout + - install-foundry + - install-ipfs - run-ipfs-daemon - yarn-install diff --git a/.circleci/install-foundry.sh b/.circleci/install-foundry.sh deleted file mode 100755 index f1eb562a7f..0000000000 --- a/.circleci/install-foundry.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -pushd . -cd $HOME - -export PATH="$PATH:$HOME/.foundry/bin" -echo 'export PATH=$PATH:$HOME/.foundry/bin' >> ~/.bashrc -curl -L https://foundry.paradigm.xyz | bash -foundryup - -popd diff --git a/.circleci/install-ipfs.sh b/.circleci/install-ipfs.sh deleted file mode 100755 index 2cf26b759e..0000000000 --- a/.circleci/install-ipfs.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -pushd . -cd $HOME - -export PATH="$PATH:$HOME/go-ipfs" -echo 'export PATH=$PATH:$HOME/go-ipfs' >> ~/.bashrc -LATEST_VERSION=$(curl -sSL https://dist.ipfs.tech/go-ipfs/versions | tail -n 1) -LATEST_VERSION_NUMBER=${LATEST_VERSION#*v} -DOWNLOAD_URL="https://dist.ipfs.tech/go-ipfs/${LATEST_VERSION}/go-ipfs_${LATEST_VERSION}_linux-amd64.tar.gz" -echo "DOWNLOAD_URL=$DOWNLOAD_URL" -curl -sSL -o ipfs.tar.gz $DOWNLOAD_URL -tar -xzf ipfs.tar.gz -ipfs init - -popd