forked from dapphub/dapptools
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from vulcanize/ci
docker and CI
- Loading branch information
Showing
11 changed files
with
152 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,23 @@ | ||
name: "Build" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- statediff | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest ] | ||
# we need this to map platform names as used by github to | ||
# the attribute names defined in release.nix | ||
include: | ||
- os: ubuntu-latest | ||
os_attr: linux | ||
- os: macos-latest | ||
os_attr: darwin | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# v10 | ||
- uses: cachix/install-nix-action@63cf434de4e4292c6960639d56c5dd550e789d77 | ||
with: | ||
# we use the nixpkgs defined in default.nix | ||
skip_adding_nixpkgs_channel: false | ||
# v6 | ||
- uses: cachix/cachix-action@490a246fbc7f92208d309eeb54383a4d828cedc1 | ||
with: | ||
name: dapp | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- name: run dapp tests | ||
run: nix-env -iA nixpkgs.bashInteractive && nix-shell --pure src/dapp-tests/shell.nix --command 'make --directory src/dapp-tests' | ||
- name: run hevm symbolic tests | ||
run: nix-build -j 1 -A hevm-tests | ||
- run: nix-build release.nix -A dapphub.${{ matrix.os_attr }}.stable | ||
# - name: run dapp tests | ||
# run: nix-env -iA nixpkgs.bashInteractive && nix-shell --pure src/dapp-tests/shell.nix --command 'make --directory src/dapp-tests' | ||
- name: Get the version | ||
id: vars | ||
run: echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) | ||
- name: Run docker build | ||
run: make docker-build | ||
- name: Tag docker image | ||
run: docker tag vulcanize/dapptools docker.pkg.github.com/vulcanize/dapptools/dapptools:${{steps.vars.outputs.sha}} | ||
- name: Docker Login | ||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin | ||
- name: Docker Push | ||
run: docker push docker.pkg.github.com/vulcanize/dapptools/dapptools:${{steps.vars.outputs.sha}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "Build" | ||
on: | ||
pull_request: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# - uses: cachix/install-nix-action@63cf434de4e4292c6960639d56c5dd550e789d77 | ||
# with: | ||
# # we use the nixpkgs defined in default.nix | ||
# skip_adding_nixpkgs_channel: false | ||
# - name: run dapp tests | ||
# run: nix-env -iA nixpkgs.bashInteractive && nix-shell --pure src/dapp-tests/shell.nix --command 'make --directory src/dapp-tests' | ||
- name: Run docker build | ||
run: make docker-build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish Docker image | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
push_to_registries: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get the version | ||
id: vars | ||
run: | | ||
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) | ||
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) | ||
- name: Docker Login to Github Registry | ||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin | ||
- name: Docker Pull | ||
run: docker pull docker.pkg.github.com/vulcanize/dapptools/dapptools:${{steps.vars.outputs.sha}} | ||
- name: Docker Login to Docker Registry | ||
run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u vulcanizejenkins --password-stdin | ||
- name: Tag docker image | ||
run: docker tag docker.pkg.github.com/vulcanize/dapptools/dapptools:${{steps.vars.outputs.sha}} vulcanize/dapptools:${{steps.vars.outputs.tag}} | ||
- name: Docker Push to Docker Hub | ||
run: docker push vulcanize/dapptools:${{steps.vars.outputs.tag}} | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.PHONY: docker-build | ||
docker-build: | ||
docker build -t vulcanize/dapptools -f docker/Dockerfile . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM nixos/nix:2.3.6 | ||
|
||
# https://github.com/sgerrand/alpine-pkg-glibc | ||
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ | ||
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk && \ | ||
apk add glibc-2.32-r0.apk | ||
|
||
#USER guest | ||
WORKDIR /root | ||
|
||
# copy all files | ||
ADD . . | ||
RUN nix-shell --pure -p cacert cachix curl git jq nix --run "bash docker/install.sh" | ||
|
||
EXPOSE 8545 | ||
EXPOSE 8546 | ||
ENTRYPOINT ["./docker/startup_script_wrapper.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
GREEN='\033[0;32m' | ||
RED='\033[0;31m' | ||
NC='\033[0m' | ||
|
||
oops() { | ||
>&2 echo -e "${RED}error:${NC} $1" | ||
exit 1 | ||
} | ||
|
||
#[[ "$(id -u)" -eq 0 ]] && oops "Please run this script as a regular user" | ||
|
||
#API_OUTPUT=$(curl -sS https://api.github.com/repos/vulcanize/dapptools/releases/latest) | ||
#RELEASE=$(echo "$API_OUTPUT" | jq -r .tarball_url) | ||
# | ||
#[[ $RELEASE == null ]] && oops "No release found in ${API_OUTPUT}" | ||
|
||
cachix use dapp | ||
nix-env -iA dapp hevm seth solc -f . | ||
|
||
echo -e "${GREEN}All set!${NC}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
# clean up | ||
trap 'killall geth && rm -rf "$TMPDIR"' EXIT | ||
trap "exit 1" SIGINT SIGTERM | ||
|
||
TMPDIR=$(mktemp -d) | ||
dapp testnet --rpc-addr 0.0.0.0 --chain-id 4 --dir "$TMPDIR" & | ||
echo "sleeping 90 sec" | ||
# give it a few secs to start up | ||
sleep 90 | ||
|
||
read -r ACC BAL <<< "$(seth ls --keystore "$TMPDIR/8545/keystore")" | ||
echo $ACC | ||
echo $BAL | ||
|
||
|
||
# Deploy a contract: | ||
solc --bin --bin-runtime docker/stateful.sol -o "$TMPDIR" | ||
A_ADDR=$(seth send --create "$(<"$TMPDIR"/A.bin)" "constructor(uint y)" 1 --from "$ACC" --keystore "$TMPDIR"/8545/keystore --password /dev/null --gas 0xffffffff) | ||
|
||
echo $A_ADDR | ||
|
||
# Call transaction | ||
|
||
TX=$(seth send "$A_ADDR" "off()" --gas 0xffff --password /dev/null --from "$ACC" --keystore "$TMPDIR"/8545/keystore --async) | ||
echo $TX | ||
#RESULT=$(seth run-tx "$TX") | ||
#echo $RESULT | ||
|
||
# Run forever | ||
tail -f /dev/null |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
nix-shell -p cacert cachix curl jq nix --run "sh docker/startup_script.sh" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
contract A { | ||
uint x; | ||
|
||
constructor(uint y) public { | ||
x = y; | ||
} | ||
|
||
function off() public { | ||
require(x == 1); | ||
x = 0; | ||
} | ||
|
||
function on() public { | ||
require(x == 0); | ||
x = 1; | ||
} | ||
} |
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