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 72b9c63
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 123 deletions.
53 changes: 29 additions & 24 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,22 @@ 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') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt

- name: Check Solana version
run: |
Expand Down Expand Up @@ -89,7 +94,7 @@ 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: |
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
69 changes: 0 additions & 69 deletions ci/rust-version.sh

This file was deleted.

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 72b9c63

Please sign in to comment.