-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Update third-party tests
workflow
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update third-party tests | ||
|
||
on: | ||
schedule: | ||
- cron: "0 3 * * 2" # 2 = Tuesday | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: update-third-party-tests-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- run: | | ||
scripts/update_third_party_tests.sh | ||
cargo test --test third_party_0 --test third_party_1 | ||
env: | ||
BLESS: 1 | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
title: "Update AFLplusplus" | ||
token: ${{ secrets.REPO_TOKEN }} | ||
branch-suffix: random |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /bin/bash | ||
|
||
# set -x | ||
set -euo pipefail | ||
|
||
if [[ $# -ne 0 ]]; then | ||
echo "$0: expect no arguments" >&2 | ||
exit 1 | ||
fi | ||
|
||
SCRIPTS="$(dirname "$(realpath "$0")")" | ||
WORKSPACE="$(realpath "$SCRIPTS"/..)" | ||
|
||
cd "$WORKSPACE"/necessist/tests/third_party_tests | ||
|
||
find . -name '*.toml' | | ||
while read X; do | ||
URL="$(cat "$X" | sed -n 's/^url = "\([^"]*\)"$/\1/;T;p')" | ||
REV="$(cat "$X" | sed -n 's/^rev = "\([^"]*\)"$/\1/;T;p')" | ||
if [[ -z "$REV" ]]; then | ||
continue; | ||
fi | ||
# smoelius: Skip revisions that are hashes. | ||
if [[ "$REV" =~ [0-9A-Fa-f]{7,40} ]]; then | ||
continue; | ||
fi | ||
ORG="$(echo "$URL" | sed -n 's,^https://github.com/\([^/]*\)/[^/]*.*$,\1,;T;p')" | ||
REPO="$(echo "$URL" | sed -n 's,^https://github.com/[^/]*/\([^/]*\).*$,\1,;T;p')" | ||
LATEST_RELEASE_URL="https://api.github.com/repos/$ORG/$REPO/releases/latest" | ||
LATEST_RELEASE="$(curl \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authentication: Bearer $GITHUB_TOKEN" \ | ||
--silent --show-error "$LATEST_RELEASE_URL")" | ||
TAG="$(echo "$LATEST_RELEASE" | jq -r .tag_name)" | ||
if [[ "$TAG" = 'null' ]]; then | ||
echo -n "$X: " | ||
echo "$LATEST_RELEASE" | jq . | ||
continue | ||
fi | ||
sed -i "s/^rev = \"[^\"]*\"$/rev = \"$TAG\"/" "$X" | ||
done |