Skip to content

Commit

Permalink
GitHub workflow attempt #3
Browse files Browse the repository at this point in the history
  • Loading branch information
dannymcgee committed May 10, 2024
1 parent 29eb67e commit 4a323e8
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 48 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Node
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- uses: actions/cache@v4
with:
path: node_modules/
key: ${{ runner.os }}-setup-node-${{ hashFiles('**/package.json', '**/package-lock.json') }}
- name: Install node dependencies
run: npm ci
- name: Ensure unambiguous `main`
if: github.ref != 'refs/heads/main'
run: |
git remote set-branches origin main
git fetch --depth 1 origin main
git branch main origin/main
23 changes: 23 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Setup Rust
runs:
using: composite
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-setup-rust-${{ hashFiles('**/Cargo.toml') }}
- name: Set default Rust toolchain
run: rustup default stable
- name: Verify Rust setup
run: rustup show
95 changes: 47 additions & 48 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,58 @@ jobs:
# git fetch --depth 1 origin main
# git branch main origin/main

setup-rust:
runs-on: ubuntu-latest
# needs: checkout-repo
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-setup-rust-${{ hashFiles('**/Cargo.toml') }}
- name: Set default Rust toolchain
run: rustup default stable
- name: Verify Rust setup
run: rustup show
# setup-rust:
# runs-on: ubuntu-latest
# # needs: checkout-repo
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: clippy
# - uses: dtolnay/rust-toolchain@nightly
# with:
# components: rustfmt
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-setup-rust-${{ hashFiles('**/Cargo.toml') }}
# - name: Set default Rust toolchain
# run: rustup default stable
# - name: Verify Rust setup
# run: rustup show

setup-node:
runs-on: ubuntu-latest
# needs: checkout-repo
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- uses: actions/cache@v4
with:
path: node_modules/
key: ${{ runner.os }}-setup-node-${{ hashFiles('**/package.json', '**/package-lock.json') }}
- name: Install node dependencies
run: npm ci
# setup-node:
# runs-on: ubuntu-latest
# # needs: checkout-repo
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: npm
# - uses: actions/cache@v4
# with:
# path: node_modules/
# key: ${{ runner.os }}-setup-node-${{ hashFiles('**/package.json', '**/package-lock.json') }}
# - name: Install node dependencies
# run: npm ci

validate-affected:
runs-on: ubuntu-latest
needs:
- setup-rust
- setup-node
steps:
- uses: actions/checkout@v4
- name: Ensure unambiguous `main`
if: github.ref != 'refs/heads/main'
run: |
git remote set-branches origin main
git fetch --depth 1 origin main
git branch main origin/main
- uses: ./.github/actions/setup-rust
- uses: ./.github/actions/setup-node
# - name: Ensure unambiguous `main`
# if: github.ref != 'refs/heads/main'
# run: |
# git remote set-branches origin main
# git fetch --depth 1 origin main
# git branch main origin/main
- name: nx affected
run: npx nx affected -t format lint test --configuration ci

0 comments on commit 4a323e8

Please sign in to comment.