Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/sqlite.yml
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