build(repo): remove any kinda of nkey hardcoded #172
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, edited, reopened] | |
env: | |
CARGO_TERM_COLOR: always | |
CLICOLOR: 1 | |
RUST_VERSION: 1.79.0 | |
CI: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-cache: | |
name: Build and Cache Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Build project | |
run: make build | |
validate-title: | |
name: Validate PR Title | |
runs-on: ubuntu-latest | |
steps: | |
- uses: amannn/action-semantic-pull-request@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
requireScope: true | |
types: | | |
arch | |
build | |
ci | |
docs | |
feat | |
fix | |
perf | |
refactor | |
test | |
scopes: | | |
repo | |
deps | |
release | |
data-stream | |
sdk-rust | |
sdk-ts | |
lockfile: | |
name: Validate Lockfile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo update --workspace --locked | |
commitlint: | |
name: Validating commits | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node && PNPM | |
uses: ./.github/actions/setup-node | |
- name: Install commitlint | |
run: | | |
npm install commitlint@latest | |
npm install @commitlint/config-conventional | |
- name: Validate current commit (last commit) with commitlint | |
if: github.event_name == 'push' | |
run: npx commitlint --config ./.commitlintrc.yaml --last --verbose | |
- name: Validate PR commits with commitlint | |
if: github.event_name == 'pull_request' | |
run: | | |
npx commitlint \ | |
--config ./.commitlintrc.yaml \ | |
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \ | |
--to ${{ github.event.pull_request.head.sha }} \ | |
--verbose | |
lint: | |
name: Linting | |
needs: build-and-cache | |
if: "!startsWith(github.head_ref, 'releases/')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: nightly | |
target: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Running linting | |
run: make lint | |
test: | |
name: Cargo Tests | |
needs: build-and-cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Install nats-io/nkeys | |
run: | | |
go install github.com/nats-io/nkeys/nk@latest | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: Generate NATS NKeys | |
run: | | |
NKEY_OUTPUT=$(nk -gen user) | |
echo "NATS_NKEY_SEED=$(echo "$NKEY_OUTPUT" | sed -n '1p')" >> $GITHUB_ENV | |
echo "NATS_NKEY_USER=$(echo "$NKEY_OUTPUT" | sed -n '2p')" >> $GITHUB_ENV | |
- name: Create .env file for NATS | |
run: | | |
cp .env.sample .env | |
sed -i 's/generated-nats-nkey-seed/${{ env.NATS_NKEY_SEED }}/g' .env | |
sed -i 's/generated-nats-nkey-user/${{ env.NATS_NKEY_USER }}/g' .env | |
- name: Run tests | |
run: | | |
make start/nats | |
make test | |
- name: Stop NATS | |
if: always() | |
run: make stop/nats |