diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index fb181cc0ef..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,70 +0,0 @@ -skip_tags: true - -branches: - only: - - master - - /^release\/.*$/ - -build: - verbosity: minimal - -matrix: - fast_finish: true - -environment: - ZEUS_HOOK_BASE: - secure: dcqtt6sxxBV0tDkXmPZOyz96KWmjtSz6ZqRd9mw9GXC/C4Zcwqofxt2Kh4EP7hPEFIewRRl6xkhW53HgItdt7iVmFSHuufpGoSpzse8cgg3zfE08f/u0a2EOvuRjdtoi4E/9Znrj2HY+CC+G4j2UKWzp6EcSc++qbgSMl1h6zMs= - CARGO_HTTP_CHECK_REVOKE: false - channel: stable - arch: x86_64 - -configuration: - - Test - - Release - -for: - - matrix: - only: - - configuration: Test - - build: off # Skip default build discovery and just run tests - test_script: - - C:\MinGW\bin\mingw32-make test-rust - - - matrix: - only: - - configuration: Release - - branches: - only: - - /^release\/.*$/ - - build_script: - - C:\MinGW\bin\mingw32-make release - after_build: - - zeus upload -t "application/octet-stream" -n relay-Windows-%arch%.exe .\target\release\relay.exe - - 7z a .\relay-pdb.zip .\target\release\relay.pdb - - zeus upload -t "application/octet-stream" -n relay-Windows-%arch%-pdb.zip .\relay-pdb.zip - -install: - # Push job information to Zeus - - npm install -g @zeus-ci/cli - - zeus job update --status=pending -B "%APPVEYOR_PULL_REQUEST_TITLE%" -J "%APPVEYOR_JOB_NAME%" || - echo "%$APPVEYOR_REPO_BRANCH%" | findstr /V "release/">nul - # Install the rest - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init -yv --default-toolchain %channel% --default-host %arch%-pc-windows-msvc - - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - - rustc -vV - - cargo -vV - # Check out submodules - - git submodule update --init --recursive - -on_success: - - zeus job update --status=passed || echo "%$APPVEYOR_REPO_BRANCH%" | findstr /V "release/">nul - -on_failure: - - zeus job update --status=failed || echo "%$APPVEYOR_REPO_BRANCH%" | findstr /V "release/">nul - -on_finish: - - C:\MinGW\bin\mingw32-make clean-target-dir diff --git a/.craft.yml b/.craft.yml index 29e7163964..00e8a87d7f 100644 --- a/.craft.yml +++ b/.craft.yml @@ -1,5 +1,5 @@ --- -minVersion: "0.10.0" +minVersion: "0.11.1" github: owner: getsentry repo: relay diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml new file mode 100644 index 0000000000..f57ed017b9 --- /dev/null +++ b/.github/workflows/build_binary.yml @@ -0,0 +1,116 @@ +name: Binary Release Build + +on: + push: + branches: + - release/** + +jobs: + linux: + name: Linux + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Build in Docker + run: scripts/docker-build-linux.sh + env: + BUILD_ARCH: x86_64 + RELAY_FEATURES: ssl + + - name: Bundle Debug File + run: zip -r relay-debug.zip target/x86_64-unknown-linux-gnu/release/relay.debug + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/octet-stream" -n relay-Linux-x86_64 target/x86_64-unknown-linux-gnu/release/relay + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip" -n relay-Linux-x86_64-debug.zip relay-debug.zip + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + + macos: + name: macOS + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - name: Run Cargo Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --manifest-path=relay/Cargo.toml --release --features ssl + + - name: Bundle dSYM + run: zip -r relay-dsym.zip target/release/relay.dSYM + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/octet-stream" -n relay-Darwin-x86_64 target/release/relay + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip" -n relay-Darwin-x86_64-dsym.zip relay-dsym.zip + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + + windows: + name: Windows + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - name: Run Cargo Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --manifest-path=relay/Cargo.toml --release --features ssl + + - name: Bundle PDB + run: | + Install-Module 7Zip4PowerShell -Force -Verbose + 7z a .\relay-pdb.zip .\target\release\relay.pdb + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/octet-stream" -n relay-Windows-x86_64.exe target/release/relay.exe + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip" -n relay-Windows-x86_64-pdb.zip relay-pdb.zip + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} diff --git a/.github/workflows/build_library.yml b/.github/workflows/build_library.yml new file mode 100644 index 0000000000..27e60ea6c8 --- /dev/null +++ b/.github/workflows/build_library.yml @@ -0,0 +1,105 @@ +name: Library Release Build + +on: + push: + branches: + - release-library/** + +jobs: + linux: + strategy: + fail-fast: false + matrix: + build-arch: [i686, x86_64] + + name: Python Linux ${{ matrix.build-arch }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Build in Docker + run: scripts/docker-manylinux.sh + env: + BUILD_ARCH: ${{ matrix.build-arch }} + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip+wheel" py/dist/* + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + + macos: + name: Python macOS + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - uses: actions/setup-python@v2 + with: + python-version: 2.7 + + - name: Build Wheel + run: | + pip install wheel + python setup.py bdist_wheel + working-directory: py + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip+wheel" py/dist/* + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + + sdist: + name: Python sdist + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v2 + with: + python-version: 2.7 + + - name: Build sdist + run: python setup.py sdist --format=zip + working-directory: py + + - uses: actions/setup-node@v1 + + - name: Upload to Zeus + env: + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }} + run: | + npm install -D @zeus-ci/cli + npx zeus job update -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} + npx zeus upload -b ${{ github.run_id }} -j ${{ github.job }} -t "application/zip+wheel" py/dist/* + npx zeus job update --status=passed -b ${{ github.run_id }} -j ${{ github.job }} -r ${{ github.sha }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2092f7cb62..db4abf9f30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - master + - release/** + - release-library/** pull_request: @@ -16,6 +18,19 @@ jobs: with: submodules: recursive + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install Dependencies + run: pip install -U -r requirements-dev.txt + + - name: Run Black + run: black --check py tests --exclude '\.eggs|sentry_relay/_lowlevel.*' + + - name: Run Flake8 + run: flake8 py + - uses: actions-rs/toolchain@v1 id: toolchain with: @@ -44,9 +59,18 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} args: --workspace --all-features --tests -- -D clippy::all - cargo_docs: - name: Cargo Docs - runs-on: ubuntu-latest + test: + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + + name: Test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + # Skip redundant checks for library releases + if: "!startsWith(github.ref, 'refs/heads/release-library/')" + steps: - uses: actions/checkout@v2 with: @@ -57,7 +81,6 @@ jobs: with: toolchain: stable profile: minimal - components: rust-docs override: true - uses: actions/cache@v2 @@ -66,20 +89,32 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: doc-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + key: test-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - - run: make doc - - - name: Deploy - if: github.ref == 'refs/heads/master' - uses: peaceiris/actions-gh-pages@v3 + - name: Run Cargo Tests + uses: actions-rs/cargo@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: target/doc + command: test + args: --workspace - event_schema: - name: Event Schema + test_all: + name: Test All Features (ubuntu-latest) runs-on: ubuntu-latest + + # Skip redundant checks for library releases + if: "!startsWith(github.ref, 'refs/heads/release-library/')" + + # Testing all features requires Docker container operations that are only available on + # `ubuntu-latest`. This `test-all` job is to be seen as complementary to the `test` job. If + # services become available on other platforms, the jobs should be consolidated. See + # https://docs.github.com/en/actions/guides/about-service-containers + + services: + redis: # https://docs.github.com/en/actions/guides/creating-redis-service-containers + image: redis + ports: + - 6379:6379 + steps: - uses: actions/checkout@v2 with: @@ -98,50 +133,93 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: schema-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + key: test-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Generate Schema + - name: Run Cargo Tests uses: actions-rs/cargo@v1 with: - command: run - args: -p generate-schema -- -o event.schema.json + command: test + args: --workspace --all-features + + test_py: + strategy: + fail-fast: false + matrix: + python-version: [2.7, 3.7] + + # Skip redundant checks for binary releases + if: "!startsWith(github.ref, 'refs/heads/release/')" + + name: Test Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Dependencies + run: pip install -U pytest + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: pytest-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Deploy - if: github.ref == 'refs/heads/master' + - name: Build and Install Library + run: pip install -v --editable py env: - GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }} - run: | - git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)" - git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)" - git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-data-schemas - cd sentry-data-schemas/ - mkdir -p ./relay/ - mv ../event.schema.json relay/event.schema.json - git add relay/event.schema.json - - echo "attempting commit" - if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then - echo "Stopping, no changes" - exit 0 - fi - - for i in 1 2 3 4 5; do - echo "git push; Attempt $i" - if git push; then - exit 0 - fi - - git pull --rebase - done - - echo "Failed to push" - exit 1 - - metrics_docs: - name: Metrics Docs + RELAY_DEBUG: 1 + + - name: Run Python Tests + run: pytest -v py + + test_integration: + name: Integration Tests runs-on: ubuntu-latest + + # Skip redundant checks for library releases + if: "!startsWith(github.ref, 'refs/heads/release-library/')" + + services: + redis: # https://docs.github.com/en/actions/guides/creating-redis-service-containers + image: redis + ports: + - 6379:6379 + + zookeeper: + image: confluentinc/cp-zookeeper + env: + ZOOKEEPER_CLIENT_PORT: 2181 + + kafka: + image: confluentinc/cp-kafka + env: + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1 + ports: + - 9092:9092 + steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions-rs/toolchain@v1 id: toolchain @@ -156,40 +234,20 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: metrics-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + key: integration-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Document Metrics + - name: Cargo build uses: actions-rs/cargo@v1 with: - command: run - args: -p document-metrics -- -o relay_metrics.json + command: build + args: --all-features - - name: Deploy - if: github.ref == 'refs/heads/master' - env: - GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }} - run: | - git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)" - git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)" - git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-docs - cd sentry-docs/ - mv ../relay_metrics.json src/data/relay_metrics.json - git add src/data/relay_metrics.json - - echo "attempting commit" - if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then - echo "Stopping, no changes" - exit 0 - fi - - for i in 1 2 3 4 5; do - echo "git push; Attempt $i" - if git push; then - exit 0 - fi - - git pull --rebase - done - - echo "Failed to push" - exit 1 + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install dependencies + run: pip install -U -r requirements-test.txt + + - name: Run tests + run: pytest tests -n auto -v diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..4087e76c6a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,163 @@ +name: Deploy + +on: + push: + branches: + - master + + # Run actions on PRs, but only deploy on master + pull_request: + +jobs: + cargo_docs: + name: Cargo Docs + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + components: rust-docs + override: true + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: doc-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + + - run: make doc + + - name: Deploy + if: github.ref == 'refs/heads/master' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: target/doc + + event_schema: + name: Event Schema + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: schema-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Generate Schema + uses: actions-rs/cargo@v1 + with: + command: run + args: -p generate-schema -- -o event.schema.json + + - name: Deploy + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }} + run: | + git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)" + git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)" + git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-data-schemas + cd sentry-data-schemas/ + mkdir -p ./relay/ + mv ../event.schema.json relay/event.schema.json + git add relay/event.schema.json + + echo "attempting commit" + if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then + echo "Stopping, no changes" + exit 0 + fi + + for i in 1 2 3 4 5; do + echo "git push; Attempt $i" + if git push; then + exit 0 + fi + + git pull --rebase + done + + echo "Failed to push" + exit 1 + + metrics_docs: + name: Metrics Docs + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: stable + profile: minimal + override: true + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: metrics-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Document Metrics + uses: actions-rs/cargo@v1 + with: + command: run + args: -p document-metrics -- -o relay_metrics.json + + - name: Deploy + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }} + run: | + git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)" + git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)" + git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-docs + cd sentry-docs/ + mv ../relay_metrics.json src/data/relay_metrics.json + git add src/data/relay_metrics.json + + echo "attempting commit" + if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then + echo "Stopping, no changes" + exit 0 + fi + + for i in 1 2 3 4 5; do + echo "git push; Attempt $i" + if git push; then + exit 0 + fi + + git pull --rebase + done + + echo "Failed to push" + exit 1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a94df2fd5e..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,164 +0,0 @@ -language: python -python: "3.7" -os: linux - -git: - depth: 1 - -branches: - only: - - master - - /^release\/[\d.]+$/ - - /^release-library\/[\d.]+$/ - -before_install: - - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN:-stable} - - export PATH=~/.cargo/bin/:$PATH - - '[ "$TRAVIS_BRANCH" != "master" ] || export PYTEST_SENTRY_ALWAYS_REPORT=1' - -install: skip - -before_cache: - - make clean-target-dir - -jobs: - fast_finish: true - include: - # ------------------------------------- - # RUST TESTS - # ------------------------------------- - - - name: "test: relay[linux]" - if: NOT branch ~= /^release-library\/[\d.]+$/ - addons: - apt: - packages: - - libssl-dev - services: - - redis - script: make -e test-rust-all - - - name: "test: relay[macos]" - if: branch ~= /^release\/[\d.]+$/ - os: osx - language: generic - install: - - brew update-reset - - brew install redis - - brew services start redis - script: make -e test-rust-all - - # ------------------------------------- - # PYTHON LIBRARY TESTS - # ------------------------------------- - - - name: "test: librelay" - if: NOT branch ~= /^release\/[\d.]+$/ - script: make -e test-python - - - name: "test: librelay[py2]" - python: "2.7" - if: NOT branch ~= /^release\/[\d.]+$/ - script: make -e RELAY_PYTHON_VERSION=python2 test-python - - # ------------------------------------- - # EXECUTALE INTEGRATION TESTS - # ------------------------------------- - - - name: "integration-test: relay" - if: NOT branch ~= /^release-library\/[\d.]+$/ - env: - - KAFKA_BOOTSTRAP_SERVER="localhost:9092" - install: - - export PATH=$PATH:$HOME/.cargo/bin - - wget https://github.com/yyyar/gobetween/releases/download/0.6.0/gobetween_0.6.0_linux_amd64.tar.gz -O - | tar xz; mv gobetween $HOME/.cargo/bin - - sudo add-apt-repository ppa:vbernat/haproxy-1.8 -y - - sudo apt-get clean && sudo rm -r /var/lib/apt/lists/* - - sudo apt-get update - - sudo apt-get install haproxy redis-server -y - # Start Zookeeper, Kafka and Redis - - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.2-3 - - docker run -d --network host --name kafka -e KAFKA_ZOOKEEPER_CONNECT=localhost:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://$KAFKA_BOOTSTRAP_SERVER -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:4.1.2-3 - - sudo service redis-server start --bind 127.0.0.1 - script: - - make -e test-integration - - # ------------------------------------- - # RUST RELEASE BUILDS - # ------------------------------------- - - - name: "release: relay[linux]" - if: branch ~= /^release\/[\d.]+$/ - language: generic - before_install: skip - services: - - docker - env: - - BUILD_ARCH=x86_64 - script: - - make -e docker - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/octet-stream" -n relay-Linux-x86_64 target/x86_64-unknown-linux-gnu/release/relay || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zip relay-debug.zip target/x86_64-unknown-linux-gnu/release/relay.debug - - zeus upload -t "application/octet-stream" -n relay-Linux-x86_64-debug.zip relay-debug.zip || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - - name: "release: relay[macos]" - if: branch ~= /^release\/[\d.]+$/ - os: osx - language: generic - script: - - make -e release - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/octet-stream" -n relay-Darwin-x86_64 target/release/relay || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zip -r relay-dsym.zip target/release/relay.dSYM - - zeus upload -t "application/octet-stream" -n relay-Darwin-x86_64-dsym.zip relay-dsym.zip || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - # ------------------------------------- - # PYTHON RELEASE BUILDS - # ------------------------------------- - - - name: "release: librelay[linux-x86]" - if: branch ~= /^release-library\/[\d.]+$/ - env: BUILD_ARCH=i686 - language: generic - script: - - make -e wheel-manylinux - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/zip+wheel" py/dist/* || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - - name: "release: librelay[linux-x86_64]" - if: branch ~= /^release-library\/[\d.]+$/ - env: BUILD_ARCH=x86_64 - language: generic - script: - - make -e wheel-manylinux - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/zip+wheel" py/dist/* || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - - name: "release: librelay[macos]" - if: branch ~= /^release-library\/[\d.]+$/ - os: osx - language: generic - osx_image: xcode9.4 - env: RELAY_PYTHON_VERSION=python - script: - - make -e wheel - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/zip+wheel" py/dist/* || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - - name: "release: librelay[sdist]" - if: branch ~= /^release-library\/[\d.]+$/ - script: - - make -e sdist - - npm install -g @zeus-ci/cli || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - - zeus upload -t "application/zip+wheel" py/dist/* || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]] - -notifications: - webhooks: - urls: - - https://zeus.ci/hooks/a3901574-fbb7-11e7-9451-0a580a280114/public/provider/travis/webhook - on_success: always - on_failure: always - on_start: always - on_cancel: always - on_error: always diff --git a/Cargo.toml b/Cargo.toml index e302d03990..4fd4c52a72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,5 +2,12 @@ members = ["relay", "relay-*", "tools/*"] default-members = ["relay"] +[profile.dev] +# Debug information slows down the build and increases caches in the +# target folder, but we don't require stack traces in most cases. +debug = false + [profile.release] +# In release, however, we do want full debug information to report +# panic and error stack traces to Sentry. debug = true diff --git a/Makefile b/Makefile index 61c63168b2..5306cbd4b3 100644 --- a/Makefile +++ b/Makefile @@ -23,10 +23,6 @@ release: setup-git @cd relay && cargo +stable build --release --locked --features ${RELAY_FEATURES} .PHONY: release -docker: setup-git - @scripts/docker-build-linux.sh -.PHONY: docker - build-linux-release: setup-git cd relay && cargo build --release --locked --features ${RELAY_FEATURES} --target=${TARGET} objcopy --only-keep-debug target/${TARGET}/release/relay{,.debug} diff --git a/py/.craft.yml b/py/.craft.yml index 582d1d6cba..cf32a2b254 100644 --- a/py/.craft.yml +++ b/py/.craft.yml @@ -1,14 +1,12 @@ --- -minVersion: "0.9.6" +minVersion: "0.11.1" github: owner: getsentry repo: relay changelogPolicy: auto statusProvider: name: github - config: - contexts: - - Travis CI - Branch + preReleaseCommand: ../scripts/bump-library.sh releaseBranchPrefix: release-library @@ -23,7 +21,7 @@ targets: cacheControl: "public, max-age=2592000" requireNames: - - /^sentry_relay-.*-py2.py3-none-macosx_10_13_x86_64.whl$/ + - /^sentry_relay-.*-py2.py3-none-macosx_10_15_x86_64.whl$/ - /^sentry_relay-.*-py2.py3-none-manylinux1_i686.whl$/ - /^sentry_relay-.*-py2.py3-none-manylinux1_x86_64.whl$/ - /^sentry-relay-.*.zip$/ diff --git a/py/CHANGELOG.md b/py/CHANGELOG.md index 33b6c840d4..da2dbc8dcf 100644 --- a/py/CHANGELOG.md +++ b/py/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Require macOS 10.15.0 or newer for the macOS wheel after moving to GitHub Actions. ([#780](https://github.com/getsentry/relay/pull/780)) + ## 0.7.0 - In PII configs, all options on hash and mask redactions (replacement characters, ignored characters, hash algorithm/key) are removed. If they still exist in the configuration, they are ignored. ([#760](https://github.com/getsentry/relay/pull/760)) @@ -19,7 +23,7 @@ ## 0.5.13 -*Note: This accidentally got released as 0.15.13 as well, which has since been yanked.* +_Note: This accidentally got released as 0.15.13 as well, which has since been yanked._ - Fix Python 3 incompatibilities in Relay authentication helpers. ([#712](https://github.com/getsentry/relay/pull/712)) diff --git a/py/tests/test_auth.py b/py/tests/test_auth.py index 4d0f498ba8..d5000c29b3 100644 --- a/py/tests/test_auth.py +++ b/py/tests/test_auth.py @@ -16,6 +16,7 @@ RESPONSE_SIG = "iPFV5KcSXDrhjY_99X8r_pMB1NQdw-YWF7hjvdrYpXmsaSier-mp1-3viWsEPIcTNbA76B4t51sjbSYFZPzXBg.eyJ0IjoiMjAyMC0wOS0wOFQxMzozMzozNS45OTU2ODJaIn0" RELAY_VERSION = "20.8.0" + def test_basic_key_functions(): sk, pk = sentry_relay.generate_key_pair() signature = sk.sign(b"some secret data") diff --git a/relay-quotas/src/redis.rs b/relay-quotas/src/redis.rs index db93ad94ef..f11d974b64 100644 --- a/relay-quotas/src/redis.rs +++ b/relay-quotas/src/redis.rs @@ -256,12 +256,15 @@ mod tests { use super::*; - lazy_static::lazy_static! { - static ref RATE_LIMITER: RedisRateLimiter = RedisRateLimiter { - pool: RedisPool::single("redis://127.0.0.1").unwrap(), + fn build_rate_limiter() -> RedisRateLimiter { + let url = std::env::var("RELAY_REDIS_URL") + .unwrap_or_else(|_| "redis://127.0.0.1:6379".to_owned()); + + RedisRateLimiter { + pool: RedisPool::single(&url).unwrap(), script: Arc::new(load_lua_script()), max_limit: None, - }; + } } #[test] @@ -297,7 +300,7 @@ mod tests { }, }; - let rate_limits: Vec = RATE_LIMITER + let rate_limits: Vec = build_rate_limiter() .is_rate_limited(quotas, scoping, 1) .expect("rate limiting failed") .into_iter() @@ -336,8 +339,10 @@ mod tests { }, }; + let rate_limiter = build_rate_limiter(); + for i in 0..10 { - let rate_limits: Vec = RATE_LIMITER + let rate_limits: Vec = rate_limiter .is_rate_limited(quotas, scoping, 1) .expect("rate limiting failed") .into_iter() @@ -371,7 +376,7 @@ mod tests { }, }; - let rate_limits: Vec = RATE_LIMITER + let rate_limits: Vec = build_rate_limiter() .is_rate_limited(&[], scoping, 1) .expect("rate limiting failed") .into_iter() @@ -413,8 +418,10 @@ mod tests { }, }; + let rate_limiter = build_rate_limiter(); + for i in 0..1 { - let rate_limits: Vec = RATE_LIMITER + let rate_limits: Vec = rate_limiter .is_rate_limited(quotas, scoping, 1) .expect("rate limiting failed") .into_iter() @@ -458,8 +465,10 @@ mod tests { }, }; + let rate_limiter = build_rate_limiter(); + for i in 0..10 { - let rate_limits: Vec = RATE_LIMITER + let rate_limits: Vec = rate_limiter .is_rate_limited(quotas, scoping, 100) .expect("rate limiting failed") .into_iter() @@ -543,7 +552,8 @@ mod tests { .map(|duration| duration.as_secs()) .unwrap(); - let mut client = RATE_LIMITER.pool.client().expect("get client"); + let rate_limiter = build_rate_limiter(); + let mut client = rate_limiter.pool.client().expect("get client"); let mut conn = client.connection(); // define a few keys with random seed such that they do not collide with repeated test runs diff --git a/scripts/docker-build-linux.sh b/scripts/docker-build-linux.sh index a6f00cc264..5fb6c1ba29 100755 --- a/scripts/docker-build-linux.sh +++ b/scripts/docker-build-linux.sh @@ -26,7 +26,6 @@ docker build --build-arg DOCKER_ARCH=${DOCKER_ARCH} \ DOCKER_RUN_OPTS=" -v $(pwd):/work - -v ${HOME}/.cargo/registry:/usr/local/cargo/registry -e TARGET=${TARGET} $BUILD_IMAGE " @@ -38,4 +37,4 @@ docker run $DOCKER_RUN_OPTS \ # Fix permissions for shared directories USER_ID=$(id -u) GROUP_ID=$(id -g) -sudo chown -R ${USER_ID}:${GROUP_ID} target/ ${HOME}/.cargo +sudo chown -R ${USER_ID}:${GROUP_ID} target/ diff --git a/scripts/docker-manylinux.sh b/scripts/docker-manylinux.sh index ac978bd2ed..4e582d0a2a 100755 --- a/scripts/docker-manylinux.sh +++ b/scripts/docker-manylinux.sh @@ -6,11 +6,10 @@ BUILD_DIR="/work" docker run \ -w /work/py \ -v `pwd`:/work \ - -v $HOME/.cargo/registry:/root/.cargo/registry \ - -it quay.io/pypa/manylinux1_${BUILD_ARCH} \ + quay.io/pypa/manylinux1_${BUILD_ARCH} \ sh manylinux.sh # Fix permissions for shared directories USER_ID=$(id -u) GROUP_ID=$(id -g) -sudo chown -R ${USER_ID}:${GROUP_ID} target/ ${HOME}/.cargo +sudo chown -R ${USER_ID}:${GROUP_ID} target/