Skip to content

Commit

Permalink
chore: adding ci for cargo machete (#252)
Browse files Browse the repository at this point in the history
* chore: adding ci for cargo machete

This adds a Makefile target to use machete to check for any unused
dependencies.

Its possible that machete has a false positive. For those cases simply
add the dependencies to the ignored list for machete in the Cargo.toml

In order to make machete happy we needed to clean up the generated
Cargo.toml files for the api-server and kubo-rpc-server crates.
Since these updates to the toml file are now more involved we use a
augtool to safely edit these files.

Builders now must install augeas/augtool.

* fix: do docker build natively
  • Loading branch information
nathanielc authored Feb 2, 2024
1 parent 25e70b3 commit e4dc833
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 414 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/rust-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ env:
jobs:
check:
runs-on: ubuntu-latest
container: 'public.ecr.aws/r5b3e0r5/3box/rust-builder:latest'
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
Expand All @@ -35,17 +35,6 @@ jobs:
# Cache only the cargo registry
cache-targets: false
- uses: mozilla-actions/[email protected]
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ARCH=linux-x86_64
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Check fmt
run: make check-fmt
- name: Check clippy
Expand All @@ -54,11 +43,13 @@ jobs:
run: |
make check-api-server
make check-kubo-rpc-server
- name: Check deps
run: make check-deps
test:
runs-on: ubuntu-latest
container: 'public.ecr.aws/r5b3e0r5/3box/rust-builder:latest'
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
Expand All @@ -67,17 +58,6 @@ jobs:
# Cache only the cargo registry
cache-targets: false
- uses: mozilla-actions/[email protected]
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ARCH=linux-x86_64
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Run tests
run: make test
build:
Expand All @@ -86,7 +66,6 @@ jobs:
build_tag: ${{ steps.build.outputs.build_tag }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
Expand All @@ -95,19 +74,6 @@ jobs:
# Cache only the cargo registry
cache-targets: false
- uses: mozilla-actions/[email protected]
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ARCH=linux-x86_64
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Build
run: make build
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
Loading

0 comments on commit e4dc833

Please sign in to comment.