Skip to content

Commit

Permalink
Prepare for self-hosted runner (#551)
Browse files Browse the repository at this point in the history
<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [x] Does not require a CHANGELOG entry
  • Loading branch information
bkchr authored Jan 20, 2025
1 parent 20ac6ff commit d59e3e1
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 115 deletions.
15 changes: 15 additions & 0 deletions .github/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

sudo apt update
sudo apt install --assume-yes openssl pkg-config g++ make cmake protobuf-compiler libssl-dev libclang-dev libudev-dev git

# Free space on the runner
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

4 changes: 3 additions & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
uses: actions/checkout@v4

- name: Verify
run: .github/changelog-processor.py CHANGELOG.md --validate-changelog
run: |
sudo apt install python3
.github/changelog-processor.py CHANGELOG.md --validate-changelog
# This will only run if all the tests in its "needs" array passed.
# Add this as your required job, becuase if the matrix changes size (new things get added)
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/check-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: Install stable Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Install Zepter
run: cargo install --locked -q zepter && zepter --version

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Dont clone historic commits.

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Install Zepter
run: cargo install --locked -q zepter && zepter --version

- name: Check features
run: |
zepter run check
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ jobs:
echo "EXTRA_FLAGS=$EXTRA_FLAGS" >> $GITHUB_ENV
echo "CHECKS=$CHECKS" >> $GITHUB_ENV
- name: Install Protoc
uses: arduino/[email protected]
with:
version: "3.6.1"
- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
shell: bash
- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Add rust-src component
run: rustup component add rust-src
shell: bash
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Run ${{ matrix.runtime.name }} Runtime Checks
#uses: "paritytech/[email protected]"
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Checkout
uses: actions/checkout@v4

- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup toolchain install $RUST_STABLE_VERSION --profile minimal --component clippy
cargo --version
cargo clippy --version
uses: dtolnay/rust-toolchain@master
with:
components: "clippy"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache-clippy"

- name: Clippy
run: cargo clippy --all-targets --locked -q
run: |
cargo clippy --version
cargo clippy --all-targets --locked -q
env:
RUSTFLAGS: "-D warnings"
SKIP_WASM_BUILD: 1
21 changes: 11 additions & 10 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
CMD: ${{ steps.get-pr-comment.outputs.group2 }} # to avoid "" around the command
run: |
echo 'help<<EOF' >> $GITHUB_OUTPUT
sudo apt install python3
python3 .github/scripts/cmd/cmd.py $CMD >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -217,14 +218,8 @@ jobs:
env:
JOB_NAME: 'cmd'
if: ${{ startsWith(github.event.comment.body, '/cmd') && !contains(github.event.comment.body, '--help') && contains(needs.fellows.outputs.github-handles, github.event.sender.login) }}
runs-on: ${{ startsWith(github.event.comment.body, '/cmd bench') && 'gitrun-001' || 'ubuntu-22.04' }}
runs-on: ${{ startsWith(github.event.comment.body, '/cmd bench') && 'self-hosted' || 'ubuntu-22.04' }}
steps:
- name: Install updates and protobuf-compiler
if: startsWith(github.event.comment.body, '/cmd bench')
run: |
sudo apt update && sudo apt install --assume-yes \
openssl pkg-config g++ make cmake protobuf-compiler curl libssl-dev libclang-dev libudev-dev git jq
- name: Get command
uses: actions-ecosystem/action-regex-match@v2
id: get-pr-comment
Expand Down Expand Up @@ -274,14 +269,19 @@ jobs:
repository: ${{ needs.get-pr-branch.outputs.repo }}
ref: ${{ needs.get-pr-branch.outputs.pr-branch }}

- name: Install updates and dependencies
if: startsWith(github.event.comment.body, '/cmd bench')
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install Rust
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
if: startsWith(steps.get-pr-comment.outputs.group2, 'fmt') || startsWith(steps.get-pr-comment.outputs.group2, 'bench')
with:
targets: "wasm32-unknown-unknown,x86_64-unknown-linux-musl"
components: "rust-src rustfmt clippy"
targets: "wasm32-unknown-unknown"
components: "rust-src, rustfmt"
toolchain: "nightly-${{env.RUST_NIGHTLY_VERSION}}"

- name: Install dependencies for bench
Expand All @@ -306,6 +306,7 @@ jobs:
echo "github.ref: ${{ github.ref }}"
echo "Running command: $CMD on branch ${{ needs.get-pr-branch.outputs.pr-branch }}"
git remote -v
sudo apt install python3
python3 .github/scripts/cmd/cmd.py $CMD
git status
git diff
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ jobs:
run: cat .github/env >> $GITHUB_ENV

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rustfmt"
toolchain: "nightly-${{env.RUST_NIGHTLY_VERSION}}"

- name: Install taplo
run: |
rustup toolchain install "nightly-$RUST_NIGHTLY_VERSION" --profile minimal --component rustfmt
cargo install taplo-cli --version $TAPLO_VERSION
- name: Rustfmt (check)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
echo "should-release=$(.github/changelog-processor.py CHANGELOG.md --should-release)" >> $GITHUB_OUTPUT
echo "version=$(.github/changelog-processor.py CHANGELOG.md --print-latest-version)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
runtime-matrix:
needs: [ collect-release-information ]
if: needs.collect-release-information.outputs.should-release == '1'
Expand All @@ -32,6 +33,7 @@ jobs:
TASKS=$(echo $(cat .github/workflows/runtimes-matrix.json) | sed 's/ //g' )
echo $TASKS
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
build-runtimes:
needs: [ runtime-matrix ]
continue-on-error: true
Expand Down
108 changes: 32 additions & 76 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,21 @@ jobs:
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Free space on the runner
run: |
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout
uses: actions/checkout@v4

- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
Expand Down Expand Up @@ -132,32 +121,21 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Free space on the runner
run: |
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout
uses: actions/checkout@v4

- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
Expand All @@ -178,32 +156,21 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Free space on the runner
run: |
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout
uses: actions/checkout@v4

- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
Expand All @@ -226,32 +193,21 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Free space on the runner
run: |
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout
uses: actions/checkout@v4

- name: Install updates and dependencies
run: .github/install-deps.sh

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
uses: dtolnay/rust-toolchain@master
with:
targets: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "${{env.RUST_STABLE_VERSION}}"

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
Expand Down

0 comments on commit d59e3e1

Please sign in to comment.