Prepare Travis CI for web3.js and explorer
This commit is contained in:
122
.travis.yml
122
.travis.yml
@ -1,18 +1,3 @@
|
|||||||
os:
|
|
||||||
- osx
|
|
||||||
- windows
|
|
||||||
|
|
||||||
language: rust
|
|
||||||
rust:
|
|
||||||
- stable
|
|
||||||
|
|
||||||
install:
|
|
||||||
- source ci/rust-version.sh
|
|
||||||
|
|
||||||
script:
|
|
||||||
- source ci/env.sh
|
|
||||||
- ci/publish-tarball.sh
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
@ -23,21 +8,92 @@ notifications:
|
|||||||
on_success: change
|
on_success: change
|
||||||
secure: F4IjOE05MyaMOdPRL+r8qhs7jBvv4yDM3RmFKE1zNXnfUOqV4X38oQM1EI+YVsgpMQLj/pxnEB7wcTE4Bf86N6moLssEULCpvAuMVoXj4QbWdomLX+01WbFa6fLVeNQIg45NHrz2XzVBhoKOrMNnl+QI5mbR2AlS5oqsudHsXDnyLzZtd4Y5SDMdYG1zVWM01+oNNjgNfjcCGmOE/K0CnOMl6GPi3X9C34tJ19P2XT7MTDsz1/IfEF7fro2Q8DHEYL9dchJMoisXSkem5z7IDQkGzXsWdWT4NnndUvmd1MlTCE9qgoXDqRf95Qh8sB1Dz08HtvgfaosP2XjtNTfDI9BBYS15Ibw9y7PchAJE1luteNjF35EOy6OgmCLw/YpnweqfuNViBZz+yOPWXVC0kxnPIXKZ1wyH9ibeH6E4hr7a8o9SV/6SiWIlbYF+IR9jPXyTCLP/cc3sYljPWxDnhWFwFdRVIi3PbVAhVu7uWtVUO17Oc9gtGPgs/GrhOMkJfwQPXaudRJDpVZowxTX4x9kefNotlMAMRgq+Drbmgt4eEBiCNp0ITWgh17BiE1U09WS3myuduhoct85+FoVeaUkp1sxzHVtGsNQH0hcz7WcpZyOM+AwistJA/qzeEDQao5zi1eKWPbO2xAhi2rV1bDH6bPf/4lDBwLRqSiwvlWU=
|
secure: F4IjOE05MyaMOdPRL+r8qhs7jBvv4yDM3RmFKE1zNXnfUOqV4X38oQM1EI+YVsgpMQLj/pxnEB7wcTE4Bf86N6moLssEULCpvAuMVoXj4QbWdomLX+01WbFa6fLVeNQIg45NHrz2XzVBhoKOrMNnl+QI5mbR2AlS5oqsudHsXDnyLzZtd4Y5SDMdYG1zVWM01+oNNjgNfjcCGmOE/K0CnOMl6GPi3X9C34tJ19P2XT7MTDsz1/IfEF7fro2Q8DHEYL9dchJMoisXSkem5z7IDQkGzXsWdWT4NnndUvmd1MlTCE9qgoXDqRf95Qh8sB1Dz08HtvgfaosP2XjtNTfDI9BBYS15Ibw9y7PchAJE1luteNjF35EOy6OgmCLw/YpnweqfuNViBZz+yOPWXVC0kxnPIXKZ1wyH9ibeH6E4hr7a8o9SV/6SiWIlbYF+IR9jPXyTCLP/cc3sYljPWxDnhWFwFdRVIi3PbVAhVu7uWtVUO17Oc9gtGPgs/GrhOMkJfwQPXaudRJDpVZowxTX4x9kefNotlMAMRgq+Drbmgt4eEBiCNp0ITWgh17BiE1U09WS3myuduhoct85+FoVeaUkp1sxzHVtGsNQH0hcz7WcpZyOM+AwistJA/qzeEDQao5zi1eKWPbO2xAhi2rV1bDH6bPf/4lDBwLRqSiwvlWU=
|
||||||
|
|
||||||
deploy:
|
os: linux
|
||||||
- provider: s3
|
dist: bionic
|
||||||
access_key_id: $AWS_ACCESS_KEY_ID
|
language: minimal
|
||||||
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
||||||
bucket: release.solana.com
|
jobs:
|
||||||
region: us-west-1
|
include:
|
||||||
skip_cleanup: true
|
- name: "Export Github Repositories"
|
||||||
acl: public_read
|
if: type = push
|
||||||
local_dir: travis-s3-upload
|
language: python
|
||||||
on:
|
git:
|
||||||
all_branches: true
|
depth: false
|
||||||
- provider: releases
|
script:
|
||||||
api_key: $GITHUB_TOKEN
|
- .travis/export-github-repo.sh web3.js test-solana-web3.js
|
||||||
skip_cleanup: true
|
- .travis/export-github-repo.sh explorer test-explorer
|
||||||
file_glob: true
|
|
||||||
file: travis-release-upload/*
|
- &release-artifacts
|
||||||
on:
|
if: type = push
|
||||||
tags: true
|
name: "macOS release artifacts"
|
||||||
|
os: osx
|
||||||
|
rust:
|
||||||
|
- stable
|
||||||
|
install:
|
||||||
|
- source ci/rust-version.sh
|
||||||
|
script:
|
||||||
|
- source ci/env.sh
|
||||||
|
- ci/publish-tarball.sh
|
||||||
|
deploy:
|
||||||
|
- provider: s3
|
||||||
|
access_key_id: $AWS_ACCESS_KEY_ID
|
||||||
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
||||||
|
bucket: release.solana.com
|
||||||
|
region: us-west-1
|
||||||
|
skip_cleanup: true
|
||||||
|
acl: public_read
|
||||||
|
local_dir: travis-s3-upload
|
||||||
|
on:
|
||||||
|
all_branches: true
|
||||||
|
- provider: releases
|
||||||
|
token: $GITHUB_TOKEN
|
||||||
|
skip_cleanup: true
|
||||||
|
file_glob: true
|
||||||
|
file: travis-release-upload/*
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
- <<: *release-artifacts
|
||||||
|
name: "Linux release artifacts"
|
||||||
|
os: linux
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get install libssl-dev libudev-dev
|
||||||
|
- <<: *release-artifacts
|
||||||
|
name: "Windows release artifacts"
|
||||||
|
os: windows
|
||||||
|
|
||||||
|
# explorer pull request
|
||||||
|
- name: "explorer"
|
||||||
|
if: branch = master
|
||||||
|
if: type = pull
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "node"
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- .travis/affects.sh ^explorer/ || travis_terminate 0
|
||||||
|
- cd explorer
|
||||||
|
|
||||||
|
script:
|
||||||
|
- npm run build
|
||||||
|
- npm run format
|
||||||
|
|
||||||
|
# web3.js pull request
|
||||||
|
- name: "web3.js"
|
||||||
|
if: branch = master
|
||||||
|
if: type = pull
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "lts/*"
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ~/.npm
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- .travis/affects.sh ^web3.js/ || travis_terminate 0
|
||||||
|
- cd explorer
|
||||||
|
|
||||||
|
script: echo todo
|
||||||
|
18
.travis/affects.sh
Executable file
18
.travis/affects.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Check if files in the commit range match a regex
|
||||||
|
#
|
||||||
|
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
git diff --name-only $TRAVIS_COMMIT_RANGE
|
||||||
|
)
|
||||||
|
|
||||||
|
for file in $(git diff --name-only $TRAVIS_COMMIT_RANGE); do
|
||||||
|
if [[ $file =~ ^"$1" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "No modifications to $1"
|
||||||
|
exit 1
|
38
.travis/export-github-repo.sh
Executable file
38
.travis/export-github-repo.sh
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Exports a subdirectory into another github repository
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
if [[ -z $GITHUB_TOKEN ]]; then
|
||||||
|
echo GITHUB_TOKEN not defined
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
pip3 install git-filter-repo
|
||||||
|
|
||||||
|
declare subdir=$1
|
||||||
|
declare repo_name=$2
|
||||||
|
|
||||||
|
[[ -n $subdir ]] || {
|
||||||
|
echo "Error: subdir not specified"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[[ -n $repo_name ]] || {
|
||||||
|
echo "Error: repo_name not specified"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
.travis/affects.sh "^$subdir/" || exit 0
|
||||||
|
echo "Exporting $subdir"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
rm -rf .github_export/"$repo_name"
|
||||||
|
git clone https://${GITHUB_TOKEN}@github.com/solana-labs/"$repo_name" .github_export/"$repo_name"
|
||||||
|
|
||||||
|
# TODO: Try using `--refs $TRAVIS_COMMIT_RANGE` to speed up the filtering
|
||||||
|
git filter-repo --subdirectory-filter "$subdir" --target .github_export/"$repo_name"
|
||||||
|
|
||||||
|
git -C .github_export/"$repo_name" push https://${GITHUB_TOKEN}@github.com/solana-labs/"$repo_name"
|
Reference in New Issue
Block a user