115 lines
3.9 KiB
YAML
115 lines
3.9 KiB
YAML
# All pipeline steps run in their own container, but the working directory (with code) is in a shared
|
|
# volume, which is mounted in all the containers. So modifying the filesystem (within the working dir)
|
|
# is persistent between build steps.
|
|
|
|
steps:
|
|
lint:
|
|
image: offline-twitter/go
|
|
commands:
|
|
- golangci-lint run
|
|
|
|
test:
|
|
image: offline-twitter/go
|
|
commands:
|
|
- mkdir pkg/persistence/test_profiles
|
|
- sample_data/init_data.sh
|
|
- go test -bench=. -cover ./...
|
|
|
|
integration_test:
|
|
image: offline-twitter/go
|
|
secrets:
|
|
# - offline_twatter_passwd
|
|
- offline_twatter_session_file
|
|
environment:
|
|
- SESSION_FILE_PATH=/tmp/Offline_Twatter.session # Temp location, to be imported by the integration test
|
|
when: # At least one
|
|
- path:
|
|
- pkg/scraper/**
|
|
- cmd/**
|
|
- branch: v*.*.*
|
|
commands:
|
|
- cd cmd
|
|
- mkdir -p $(dirname $SESSION_FILE_PATH) # Make the temp directory...
|
|
- echo "$OFFLINE_TWATTER_SESSION_FILE" > $SESSION_FILE_PATH # ...and write the session file to temp location
|
|
- ./tests.sh
|
|
|
|
webserver_test:
|
|
image: offline-twitter/go
|
|
commands:
|
|
- cd cmd
|
|
- ./compile.sh
|
|
- ./tw --profile ../sample_data/profile webserver --addr localhost:1000 &
|
|
- sleep 1
|
|
- curl localhost:1000/cernovich > webserver_test_output.html
|
|
- jobs -p | xargs -I{} kill -- -{}
|
|
|
|
# version_bump_test:
|
|
# image: offline-twitter/go
|
|
# when:
|
|
# - event: tag
|
|
# ref: refs/tags/v*.*.*
|
|
# secrets:
|
|
# # - offline_twatter_passwd
|
|
# - offline_twatter_session_file
|
|
# commands:
|
|
# - export version=$(echo $CI_COMMIT_TAG | grep -Poh "(?<=^v)\d+\.\d+\.\d+")
|
|
# - curl https://apt.playfulpachyderm.com/KEY.gpg | sudo apt-key add -
|
|
# - echo "deb https://apt.playfulpachyderm.com/ ./" | sudo tee /etc/apt/sources.list.d/offline_twitter.list
|
|
# - sudo apt update
|
|
# - sudo apt install -y offline-twitter-engine
|
|
# - which twitter
|
|
# - twitter create_profile outdated_profile
|
|
# - cd outdated_profile
|
|
# # TODO: The CI server appears to have been IP-banned. Replacing login with session-file secret for now
|
|
# # - twitter login offline_twatter "$OFFLINE_TWATTER_PASSWD"
|
|
# - echo "$OFFLINE_TWATTER_SESSION_FILE" > Offline_Twatter.session # Write the session file
|
|
# - twitter fetch_user pcmonk
|
|
# - twitter --session Offline_Twatter get_user_tweets pcmonk
|
|
# - (cd ../cmd && ./compile.sh $version)
|
|
# - which ../cmd/tw
|
|
# - ../cmd/tw fetch_user pcmonk
|
|
|
|
dpkg_build_and_upload:
|
|
when:
|
|
- event: tag
|
|
ref: refs/tags/v*.*.*
|
|
image: offline-twitter/go
|
|
secrets:
|
|
- aptrepo_id_ecdsa
|
|
commands:
|
|
- export version=$(echo $CI_COMMIT_TAG | grep -Poh "(?<=^v)\d+\.\d+\.\d+")
|
|
- cd build
|
|
- ./build_dpkg.sh $version
|
|
- eval $(ssh-agent)
|
|
- echo "$APTREPO_ID_ECDSA" | ssh-add -
|
|
- scp offline-twitter_$${version}_all.deb aptrepo@apt.playfulpachyderm.com:/apt-repo/test-repo
|
|
- ssh aptrepo@apt.playfulpachyderm.com "cd ~/test-repo && ./update.sh"
|
|
|
|
windows_build:
|
|
image: offline-twitter/go-mingw
|
|
when:
|
|
- event: tag
|
|
ref: refs/tags/v*.*.*
|
|
commands:
|
|
- cd cmd
|
|
- export version=$(echo $CI_COMMIT_TAG | grep -Poh "(?<=^v)\d+\.\d+\.\d+")
|
|
- ./windows-compile.sh $version
|
|
|
|
windows_package_and_upload:
|
|
when:
|
|
- event: tag
|
|
ref: refs/tags/v*.*.*
|
|
image: offline-twitter/innosetup
|
|
secrets:
|
|
- offline_twatter_id_ecdsa
|
|
commands:
|
|
- export version=$(echo $CI_COMMIT_TAG | grep -Poh "(?<=^v)\d+\.\d+\.\d+")
|
|
- iscc.sh /Dversion=$version /Dexe_path=`winepath -w cmd/twitter.exe` build/windows/setup.iss
|
|
- eval $(ssh-agent)
|
|
- echo "$OFFLINE_TWATTER_ID_ECDSA" | ssh-add -
|
|
- scp build/windows/Output/mysetup.exe offline-twitter@offline-twitter.com:/var/www/offline-twitter.com/downloads/offline-twitter-for-windows.exe
|
|
|
|
|
|
depends_on:
|
|
- build-docker
|