2023-07-30 15:57:37 +02:00
|
|
|
image: rust:latest
|
2023-04-10 14:27:17 +02:00
|
|
|
|
2023-07-30 15:57:37 +02:00
|
|
|
variables:
|
|
|
|
CARGO_TARGET: x86_64-unknown-linux-musl
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- rustup target add $CARGO_TARGET
|
2023-07-30 15:59:51 +02:00
|
|
|
- apt-get update -qq && apt-get install -y -qq sshpass musl
|
2023-07-30 15:57:37 +02:00
|
|
|
|
|
|
|
build:
|
2023-04-10 14:27:17 +02:00
|
|
|
stage: build
|
2023-07-30 15:57:37 +02:00
|
|
|
script:
|
|
|
|
- cargo build --release --target $CARGO_TARGET
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/$CARGO_TARGET/release/rot
|
|
|
|
expire_in: 1 week
|
|
|
|
|
|
|
|
test:
|
|
|
|
stage: test
|
2023-04-10 14:27:17 +02:00
|
|
|
image: rust:latest
|
|
|
|
script:
|
2023-04-10 14:51:47 +02:00
|
|
|
- apt update && apt install -y sqlite3 && ./test_db.sh
|
2023-04-10 14:46:53 +02:00
|
|
|
- cargo build --verbose
|
2023-04-10 14:27:17 +02:00
|
|
|
- cargo test --verbose
|
2023-07-30 15:57:37 +02:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
stage: deploy
|
|
|
|
before_script:
|
|
|
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
script:
|
|
|
|
- scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging
|
|
|
|
only:
|
|
|
|
- staging
|