Skip to content

Test CI

Test CI #7

Workflow file for this run

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