Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/vyperlang/vyper into fix/…
Browse files Browse the repository at this point in the history
…blockhash
  • Loading branch information
tserg committed Feb 21, 2024
2 parents 035a91b + 015cf81 commit 9410901
Show file tree
Hide file tree
Showing 479 changed files with 24,158 additions and 11,350 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see [our commit message style guide](../../blob/master/docs/style-guide.rst#best-practices-1) for what we would ideally like to see in a commit message.)
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see [our commit message style guide](../../master/docs/style-guide.rst#best-practices-1) for what we would ideally like to see in a commit message.)

### Description for the changelog

Expand Down
55 changes: 48 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Artifacts
name: Build artifacts

on:
workflow_dispatch:
inputs:
tag:
default: ''
push:
tags:
- '*'
branches:
- master
pull_request:
release:
types: [published] # releases and pre-releases (release candidates)

defaults:
run:
Expand All @@ -20,10 +21,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-20.04, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# grab the commit passed in via `tag`, if any
ref: ${{ github.event.inputs.tag }}
Expand All @@ -34,13 +35,15 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Generate Binary
run: >-
pip install . &&
pip install --no-binary pycryptodome --no-binary cbor2 . &&
pip install pyinstaller &&
make freeze
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -50,7 +53,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# grab the commit passed in via `tag`, if any
ref: ${{ github.event.inputs.tag }}
Expand All @@ -61,6 +64,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Generate Binary
run: >-
Expand All @@ -72,3 +76,40 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: dist/vyper.*

publish-release-assets:
needs: [windows-build, unix-build]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts/

- name: Upload assets
# fun - artifacts are downloaded into "artifact/".
working-directory: artifacts/artifact
run: |
set -Eeuxo pipefail
for BIN_NAME in $(ls)
do
curl -L \
--no-progress-meter \
-X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${BIN_NAME/+/%2B}" \
--data-binary "@${BIN_NAME}"
done
# check build success for pull requests
build-success:
if: always()
runs-on: ubuntu-latest
needs: [windows-build, unix-build]
steps:
- name: check that all builds succeeded
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
32 changes: 26 additions & 6 deletions .github/workflows/era-tester.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: era compiler tester
name: Era compiler tester

# run the matter labs compiler test to integrate their test cases
# this is intended as a diagnostic / spot check to check that we
Expand Down Expand Up @@ -38,6 +38,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version[0] }}
cache: "pip"

- name: Get cache
id: get-cache
Expand Down Expand Up @@ -84,14 +85,33 @@ jobs:
**/era-compiler-tester
key: ${{ runner.os }}-${{ env.ERA_HASH }}-${{ env.ERA_VYPER_HASH }}

- name: Install Vyper
- name: Build Vyper
run: |
set -Eeuxo pipefail
pip install .
echo "VYPER_VERSION=$(vyper --version | cut -f1 -d'+')" >> $GITHUB_ENV
- name: Install Vyper
run: |
mkdir era-compiler-tester/vyper-bin
echo $(which vyper)
cp $(which vyper) era-compiler-tester/vyper-bin/vyper-0.3.8
cp $(which vyper) era-compiler-tester/vyper-bin/vyper-${{ env.VYPER_VERSION }}
- name: Run tester
- name: Run tester (fast)
# Run era tester with no LLVM optimizations
continue-on-error: true
if: ${{ github.ref != 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- -v --path='tests/vyper/' --mode='M*B* 0.3.8'
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M0B0 ${{ env.VYPER_VERSION }}"
- name: Run tester (slow)
# Run era tester across the LLVM optimization matrix
continue-on-error: true
if: ${{ github.ref == 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M*B* ${{ env.VYPER_VERSION }}"
- name: Mark as success
run: |
exit 0
75 changes: 75 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy docker image to ghcr

# Deploy docker image to ghcr on pushes to master and all releases/tags.
# Note releases to docker hub are managed separately in another process
# (github sends webhooks to docker hub which triggers the build there).
# This workflow is an alternative form of retention for docker images
# which also allows us to tag and retain every single commit to master.

on:
push:
branches:
- master
release:
types: [released]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
deploy-ghcr:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
# need to fetch unshallow so that setuptools_scm can infer the version
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install python
with:
python-version: "3.11"
cache: "pip"

- name: Generate vyper/version.py
run: |
pip install .
echo "VYPER_VERSION=$(PYTHONPATH=. python vyper/cli/vyper_compile.py --version)" >> "$GITHUB_ENV"
- name: generate tag suffix
if: ${{ github.event_name != 'release' }}
run: echo "VERSION_SUFFIX=-dev" >> "$GITHUB_ENV"

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=raw,value=${{ env.VYPER_VERSION }}${{ env.VERSION_SUFFIX }}
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This workflows will upload a Python Package using Twine when a release is created
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish
name: Publish to PyPI

on:
release:
types: [released]
types: [published] # releases and pre-releases (release candidates)

jobs:

Expand All @@ -18,7 +18,7 @@ jobs:
- name: Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: "3.11"

- name: Install dependencies
run: |
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Run test suite

on: [push, pull_request]

Expand All @@ -21,6 +21,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Install Dependencies
run: pip install .[lint]
Expand All @@ -46,6 +47,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Install Tox
run: pip install tox
Expand All @@ -63,6 +65,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Install Tox
run: pip install tox
Expand All @@ -75,11 +78,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [["3.10", "310"], ["3.11", "311"]]
# run in default (optimized) and --no-optimize mode
flag: ["core", "no-opt"]

name: py${{ matrix.python-version[1] }}-${{ matrix.flag }}
python-version: [["3.11", "311"]]
# run in modes: --optimize [gas, none, codesize]
opt-mode: ["gas", "none", "codesize"]
debug: [true, false]
# run across other python versions.# we don't really need to run all
# modes across all python versions - one is enough
include:
- python-version: ["3.10", "310"]
opt-mode: gas
debug: false

name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}

steps:
- uses: actions/checkout@v1
Expand All @@ -88,12 +98,13 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version[0] }}
cache: "pip"

- name: Install Tox
run: pip install tox

- name: Run Tox
run: TOXENV=py${{ matrix.python-version[1] }}-${{ matrix.flag }} tox -r -- --reruns 10 --reruns-delay 1 -r aR tests/
run: TOXENV=py${{ matrix.python-version[1] }} tox -r -- --optimize ${{ matrix.opt-mode }} ${{ matrix.debug && '--enable-compiler-debug-mode' || '' }} -r aR tests/

- name: Upload Coverage
uses: codecov/codecov-action@v1
Expand Down Expand Up @@ -130,18 +141,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Install Tox
run: pip install tox

# fetch test durations
# NOTE: if the tests get poorly distributed, run this and commit the resulting `.test_durations` file to the `vyper-test-durations` repo.
# `TOXENV=fuzzing tox -r -- --store-durations --reruns 10 --reruns-delay 1 -r aR tests/`
# `TOXENV=fuzzing tox -r -- --store-durations -r aR tests/`
- name: Fetch test-durations
run: curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/5982755ee8459f771f2e8622427c36494646e1dd/test_durations" -o .test_durations

- name: Run Tox
run: TOXENV=fuzzing tox -r -- --splits 60 --group ${{ matrix.group }} --splitting-algorithm least_duration --reruns 10 --reruns-delay 1 -r aR tests/
run: TOXENV=fuzzing tox -r -- --splits 60 --group ${{ matrix.group }} --splitting-algorithm least_duration -r aR tests/

- name: Upload Coverage
uses: codecov/codecov-action@v1
Expand Down Expand Up @@ -171,6 +183,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- name: Install Tox
run: pip install tox
Expand Down
Loading

0 comments on commit 9410901

Please sign in to comment.