forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to Github Actions for CI (solana-labs#768)
- Loading branch information
Showing
5 changed files
with
368 additions
and
167 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 |
---|---|---|
@@ -0,0 +1,363 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
rustfmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
components: rustfmt | ||
|
||
- name: Run fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
profile: minimal | ||
components: clippy | ||
|
||
- name: Install dependencies | ||
run: | | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" | ||
sudo apt-get update | ||
sudo apt-get install -y clang-7 --allow-unauthenticated | ||
sudo apt-get install -y openssl --allow-unauthenticated | ||
sudo apt-get install -y libssl-dev --allow-unauthenticated | ||
sudo apt-get install -y libssl1.1 --allow-unauthenticated | ||
sudo apt-get install -y libudev-dev | ||
clang-7 --version | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
cargo-clippy- | ||
- name: Run clippy | ||
if: always() | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -Zunstable-options --workspace --all-targets -- --deny=warnings | ||
|
||
list_bpf_programs: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.list-bpf-programs.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: list-bpf-programs | ||
run: | | ||
JSON="{\"include\":[" | ||
for Xargo_toml in $(git ls-files -- '*/Xargo.toml'); do | ||
program_dir=$(dirname "$Xargo_toml") | ||
JSONline="{\"path\": \"$program_dir\"}," | ||
if [[ "$JSON" != *"$JSONline"* ]]; then | ||
JSON="$JSON$JSONline" | ||
fi | ||
done | ||
# Remove last "," and add closing brackets | ||
if [[ $JSON == *, ]]; then | ||
JSON="${JSON%?}" | ||
fi | ||
JSON="$JSON]}" | ||
echo $JSON | ||
# Set output | ||
echo "::set-output name=matrix::$( echo "$JSON" )" | ||
build_bpf_programs: | ||
name: Build Program ${{ matrix.path }} | ||
needs: list_bpf_programs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{fromJson(needs.list_bpf_programs.outputs.matrix)}} | ||
env: | ||
SOLANA_VERSION: v1.4.3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.47.0 # MSRV | ||
override: true | ||
profile: minimal | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: cargo-bpf-${{ matrix.path }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
cargo-bpf-${{ matrix.path }}- | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/bin/rustfilt | ||
key: cargo-bpf-bins-${{ runner.os }} | ||
restore-keys: | | ||
cargo-bpf-bins-${{ runner.os }}- | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache | ||
key: solana-${{ env.SOLANA_VERSION }}-nonce-1 | ||
restore-keys: | | ||
solana-nonce-1 | ||
- name: Install dependencies | ||
run: | | ||
cargo install rustfilt || true | ||
sh -c "$(curl -sSfL https://release.solana.com/$SOLANA_VERSION/install)" | ||
echo "PATH=/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_ENV | ||
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | ||
cargo build-bpf --version | ||
- name: Production check | ||
run: | | ||
if [ "${{ matrix.path }}" == "token-swap/program" ]; then | ||
address="SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8" | ||
SWAP_PROGRAM_OWNER_FEE_ADDRESS="$address" cargo build-bpf --manifest-path=token-swap/program/Cargo.toml --dump --features production | ||
mv spl_token_swap.so spl_token_swap_production.so | ||
fi | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build-bpf | ||
args: --manifest-path=${{ matrix.path }}/Cargo.toml --dump | ||
|
||
- name: Upload program for later jobs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: programs | ||
path: "*.so" | ||
if-no-files-found: error | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.47.0 # MSRV | ||
override: true | ||
profile: minimal | ||
|
||
- name: Install dependencies | ||
run: | | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" | ||
sudo apt-get update | ||
sudo apt-get install -y clang-7 --allow-unauthenticated | ||
sudo apt-get install -y openssl --allow-unauthenticated | ||
sudo apt-get install -y libssl-dev --allow-unauthenticated | ||
sudo apt-get install -y libssl1.1 --allow-unauthenticated | ||
sudo apt-get install -y libudev-dev | ||
clang-7 --version | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: cargo-test-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
cargo-test- | ||
- name: Run tests | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
|
||
excluded_project_tests: | ||
needs: build_bpf_programs | ||
name: Test ${{ matrix.path }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
path: | ||
- shared-memory/client | ||
- token/perf-monitor | ||
- themis/client_ristretto | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
|
||
- name: Install dependencies | ||
run: | | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" | ||
sudo apt-get update | ||
sudo apt-get install -y clang-7 --allow-unauthenticated | ||
sudo apt-get install -y openssl --allow-unauthenticated | ||
sudo apt-get install -y libssl-dev --allow-unauthenticated | ||
sudo apt-get install -y libssl1.1 --allow-unauthenticated | ||
sudo apt-get install -y libudev-dev | ||
clang-7 --version | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
${{ matrix.path }}/target | ||
key: cargo-excluded-${{ matrix.path }}-${{ hashFiles('**/Cargo.lock') }}-nonce-1 | ||
restore-keys: | | ||
cargo-excluded-${{ matrix.path }}- | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: programs | ||
path: target/bpfel-unknown-unknown/release | ||
|
||
- name: Run tests | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --manifest-path=${{ matrix.path }}/Cargo.toml -- --nocapture | ||
|
||
js_token: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_VERSION: 12.x | ||
defaults: | ||
run: | ||
working-directory: token/js | ||
needs: build_bpf_programs | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: node-token-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node-token- | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: programs | ||
path: target/bpfel-unknown-unknown/release | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run flow | ||
- run: tsc module.d.ts | ||
- run: | | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
- run: npm run start | ||
- run: PROGRAM_VERSION=2.0.4 npm run start | ||
- run: npm run localnet:down | ||
|
||
js_token_swap: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_VERSION: 12.x | ||
defaults: | ||
run: | ||
working-directory: token-swap/js | ||
needs: build_bpf_programs | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: node-token-swap-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node-token-swap | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: programs | ||
path: target/bpfel-unknown-unknown/release | ||
- run: (cd ../../token/js && npm install) | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run flow | ||
- run: tsc module.d.ts | ||
- run: | | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
- run: npm run start | ||
- name: run production test | ||
run: | | ||
(cd ../../target/bpfel-unknown-unknown/release && mv spl_token_swap_production.so spl_token_swap.so) | ||
SWAP_PROGRAM_OWNER_FEE_ADDRESS="SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8" npm run start | ||
- run: npm run localnet:down | ||
|
||
js_token_lending: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_VERSION: 12.x | ||
defaults: | ||
run: | ||
working-directory: token-lending/js | ||
needs: build_bpf_programs | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: node-token-lending-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node-token-lending- | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: programs | ||
path: target/bpfel-unknown-unknown/release | ||
- run: (cd ../../token/js && npm install) | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run build | ||
- run: | | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
- run: npm run start | ||
- run: npm run localnet:down |
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
Oops, something went wrong.