Skip to content

Commit

Permalink
ci: update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Jun 8, 2024
1 parent f5140e0 commit d80fd41
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 55 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: Release plugin
permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
tags:
- 'v*'
branches:
- 'master'
pull_request:
paths:
- '.github/workflows/release.yml'
push:
branches:
- 'master'
- 'v1.16'
- 'v1.17'
tags:
- 'v*'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand All @@ -23,13 +27,14 @@ jobs:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ["${{ matrix.os }}"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set rust version
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" | tee -a $GITHUB_ENV
RUST_VERSION="$(grep -oP 'channel = "\K\d\.\d+\.\d+(?=")' rust-toolchain.toml)"
echo "RUST_VERSION=$RUST_VERSION" >> "$GITHUB_ENV"
- name: Set env vars
run: |
Expand All @@ -42,22 +47,17 @@ jobs:
sudo apt-get update
sudo apt-get install -y libudev-dev libssl-dev libsasl2-dev libzstd-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
components: rustfmt

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ matrix.os }}-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.lock') }}-0001
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./target
key: cargo-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}-0000
restore-keys: |
cargo-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Check Solana version
run: |
Expand Down Expand Up @@ -89,13 +89,13 @@ jobs:
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.BUILD_NAME }}
body: |
${{ env.GEYSER_PLUGIN_NAME }} ${{ env.CI_TAG }}
solana ${{ env.SOLANA_VERSION }}
rust ${{ env.RUST_STABLE }}
rust ${{ env.RUST_VERSION }}
files: |
${{ env.GEYSER_PLUGIN_NAME }}-release*
target/release/config*
Expand Down
63 changes: 33 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Source:
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/.github/workflows/test.yml

name: Build plugin

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:
push:
branches:
- 'master'
- 'v1.16'
- 'v1.17'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand All @@ -20,13 +23,14 @@ jobs:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ["${{ matrix.os }}"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set rust version
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" | tee -a $GITHUB_ENV
RUST_VERSION="$(grep -oP 'channel = "\K\d\.\d+\.\d+(?=")' rust-toolchain.toml)"
echo "RUST_VERSION=$RUST_VERSION" >> "$GITHUB_ENV"
- name: Set env vars
run: |
Expand All @@ -39,40 +43,39 @@ jobs:
sudo apt-get update
sudo apt-get install -y libudev-dev libssl-dev libsasl2-dev libzstd-dev
- uses: actions-rs/toolchain@v1
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./target
key: cargo-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}-0000
restore-keys: |
cargo-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
components: rustfmt, clippy
toolchain: nightly
components: rustfmt

- uses: actions/cache@v3
- uses: dtolnay/rust-toolchain@stable
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ matrix.os }}-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.lock') }}-0001
toolchain: ${{ env.RUST_VERSION }}
components: clippy

- name: cargo tree
run: |
cargo tree
git checkout Cargo.lock
cargo tree --frozen
cargo tree --frozen --offline
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run fmt
run: cargo +nightly fmt --all -- --check

- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --tests #-- --deny=warnings
- name: Run clippy
run: cargo clippy --all-targets --tests -- -Dwarnings

- name: Build
run: ./ci/cargo-build-test.sh
Empty file modified ci/rust-version.sh
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
edition = "2021"
imports_granularity = "One"
group_imports = "One"

0 comments on commit d80fd41

Please sign in to comment.