Make preparations for first upgrade release

- Create `CHANGELOG.txt` file
- Bump ENGINE_DATABASE_VERSION
- Add an upgrade-testing step to the CI build
This commit is contained in:
Alessio 2021-12-12 19:38:28 -08:00
parent 28e44897b5
commit 9357974a29
5 changed files with 64 additions and 5 deletions

View File

@ -95,6 +95,33 @@ tasks:
duration=$SECONDS duration=$SECONDS
echo "Task completed in $(($duration / 60))m$(($duration % 60))s." echo "Task completed in $(($duration / 60))m$(($duration % 60))s."
- version_bump_test: |
SECONDS=0
sudo apt install -y curl gnupg
sudo curl https://apt.playfulpachyderm.com/KEY.gpg | apt-key add -
sudo echo "deb https://apt.playfulpachyderm.com/ ./" > /etc/apt/sources.list.d/offline_twitter.list
sudo apt update
sudo apt install -y offline-twitter-engine # Latest released version
which twitter # Ensure that it got installed
cd twitter_offline_engine/cmd
twitter create_profile outdated_profile
cd outdated_profile
# Create some sample data
twitter fetch_user michaelmalice
twitter get_user_tweets michaelmalice
# Now test the upgrade using the newer version
cd .. # Now in `cmd` directory
which ./tw # Should be here from previous step
tw fetch_user michaelmalice # Any operation other than `create_profile` should trigger the upgrade
duration=$SECONDS
echo "Task completed in $(($duration / 60))m$(($duration % 60))s."
- dpkg_build_and_upload: | - dpkg_build_and_upload: |
SECONDS=0 SECONDS=0

12
CHANGELOG.txt Normal file
View File

@ -0,0 +1,12 @@
Changelog
=========
v0.0.0
------
- Initial release.
v0.0.1
------
- Added polls

View File

@ -35,8 +35,8 @@ Section: web
Priority: optional Priority: optional
Homepage: http://offline-twitter.com Homepage: http://offline-twitter.com
Description: This utility is the scraper engine that drives \`offline-twitter\`. Description: This utility is the scraper engine that drives \`offline-twitter\`.
Download and browse content from twitter. Download and browse content from twitter. Everything you browse gets saved as
Save a local copy of everything you browse to a SQLite database. a local copy into a SQLite database on your computer.
" > dpkg_tmp/DEBIAN/control " > dpkg_tmp/DEBIAN/control

View File

@ -111,8 +111,8 @@ func TestNewProfile(t *testing.T) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
if version != 0 { if version != persistence.ENGINE_DATABASE_VERSION {
t.Errorf("Expected database version %d, but got %d", 0, version) t.Errorf("Expected database version %d, but got %d", persistence.ENGINE_DATABASE_VERSION, version)
} }
} }

View File

@ -6,7 +6,7 @@ import (
) )
const ENGINE_DATABASE_VERSION = 0 const ENGINE_DATABASE_VERSION = 1
type VersionMismatchError struct { type VersionMismatchError struct {
@ -26,7 +26,27 @@ Please upgrade this application to a newer version to use this profile. Or down
* The Nth entry is the migration that moves you from version N to version N+1 * The Nth entry is the migration that moves you from version N to version N+1
*/ */
var MIGRATIONS = []string{ var MIGRATIONS = []string{
`create table polls (rowid integer primary key,
id integer unique not null check(typeof(id) = 'integer'),
tweet_id integer not null,
num_choices integer not null,
choice1 text,
choice1_votes integer,
choice2 text,
choice2_votes integer,
choice3 text,
choice3_votes integer,
choice4 text,
choice4_votes integer,
voting_duration integer not null, -- in seconds
voting_ends_at integer not null,
last_scraped_at integer not null,
foreign key(tweet_id) references tweets(id)
);`,
} }
/** /**