Skip to content

Commit

Permalink
ci: added a github action to check if the vendored deps should be upd…
Browse files Browse the repository at this point in the history
…ated
  • Loading branch information
kpagacz authored Nov 24, 2024
1 parent c574dac commit 5eda597
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/check-declared-vendor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
branches: [main]
pull_request:
branches: ["main"]

name: Check Declared Dependencies Are Vendored

permissions: read-all

jobs:
check-vendor:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- name: Verify declared dependencies are vendored
working-directory: ./antidotum/tergo/src/rust
run: |
sh ./check_vendor_updates.sh
2 changes: 1 addition & 1 deletion .github/workflows/rpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches: ["main"]

name: R-CMD-check
name: Check antidotum R package

permissions: read-all

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

members = ["aqua", "spongia", "balnea", "unguentum", "tergo", "scopa"]
resolver = "2"
exclude = ["antidotum"]
3 changes: 3 additions & 0 deletions antidotum/tergo/src/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
vendor/
in_repo
downloaded
repo_vendor/
1 change: 1 addition & 0 deletions antidotum/tergo/src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ toml = "0.8.19"
extendr-api = "*"

[workspace]
exclude = ["vendor", "repo_vendor"]
23 changes: 23 additions & 0 deletions antidotum/tergo/src/rust/check_vendor_updates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!bin/bash

cargo update
cargo vendor

mkdir repo_vendor
tar -xvf vendor.tar.xz -C repo_vendor

find ./vendor -name 'Cargo.toml' -exec cargo generate-lockfile --manifest-path {} \;
find ./vendor -name 'Cargo.toml' -exec cargo pkgid --manifest-path {} \; | rev | cut -d'/' -f1 | rev | sort >downloaded
find ./repo_vendor -name 'Cargo.toml' -exec cargo generate-lockfile --manifest-path {} \;
find ./repo_vendor -name 'Cargo.toml' -exec cargo pkgid --manifest-path {} \; | rev | cut -d'/' -f1 | rev | sort >in_repo

if [ ! -f downloaded ] || [ ! -f in_repo ]; then
echo "Error: downloaded or in_repo file not found"
exit 1
fi

if ! diff downloaded in_repo; then
echo "Error: vendored dependencies are not the same"
echo "Please run 'vendor.sh' and commit the changes"
exit 1
fi
1 change: 1 addition & 0 deletions antidotum/tergo/src/rust/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cargo update
cargo vendor

# c.f. https://reproducible-builds.org/docs/archives/
Expand Down
Binary file modified antidotum/tergo/src/rust/vendor.tar.xz
Binary file not shown.

0 comments on commit 5eda597

Please sign in to comment.