forked from python/cpython-source-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba5439f
commit b88aca4
Showing
1 changed file
with
65 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,65 @@ | ||
name: Check SQLite sources | ||
|
||
on: | ||
push: | ||
branches: | ||
- sqlite | ||
pull_request: | ||
branches: | ||
- sqlite | ||
|
||
jobs: | ||
validate: | ||
name: "Validate SQLite sources" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: "Get SQLite version info" | ||
env: | ||
# See https://sqlite.org/c3ref/c_source_id.html | ||
SQLITE_H: sqlite3.h | ||
VERSION_RE: "^#define SQLITE_VERSION\\>.*\\([0-9]\\+.[0-9]\\+.[0-9]\\+\\).*" | ||
DATE_RE: "^#define SQLITE_SOURCE_ID.*\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\).*" | ||
id: info | ||
run: | | ||
VERSION=$(sed -n "s/${VERSION_RE}/\\1/p" $SQLITE_H) | ||
test -z $VERSION && false | ||
echo "::set-output name=version::$VERSION" | ||
# ISO 8601 date should have 10 characters: YYYY-MM-DD | ||
DATE=$(sed -n "s/${DATE_RE}/\\1/p" $SQLITE_H) | ||
test ${#DATE} -eq 10 || false | ||
echo "::set-output name=date::$DATE" | ||
- name: "Get URL" | ||
id: url | ||
env: | ||
VERSION: ${{ steps.info.outputs.version }} | ||
DATE: ${{ steps.info.outputs.date }} | ||
run: | | ||
YEAR=$(echo $DATE | cut -d '-' -f 1) | ||
MAJOR=$(echo $VERSION | cut -d '.' -f 1) | ||
MINOR=$(echo $VERSION | cut -d '.' -f 2) | ||
PATCH=$(echo $VERSION | cut -d '.' -f 3) | ||
# See https://sqlite.org/download.html | ||
printf -v ENCODED_VERSION "%d%02d%02d00" $MAJOR $MINOR $PATCH | ||
URL="https://sqlite.org/$YEAR/sqlite-amalgamation-${ENCODED_VERSION}.zip" | ||
echo "::set-output name=url::$URL" | ||
- name: "Download and validate SQLite amalgamation sources" | ||
env: | ||
URL: ${{ steps.url.outputs.url }} | ||
run: | | ||
curl -sO $URL | ||
ARCHIVE=$(basename $URL) | ||
unzip -o $ARCHIVE | ||
DIR=$(basename $ARCHIVE .zip) | ||
for _F in *.[ch]; do | ||
cmp $_F $DIR/$_F && echo "$_F: check" | ||
done |