freechat/.gitlab-ci.yml
2021-03-03 17:39:55 -08:00

143 lines
2.3 KiB
YAML

image: shockrah/freechat:0.4
stages:
- build
- test
workflow:
rules:
- if: '$CI_COMMIT_BRANCH'
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
GIT_SUBMODULE_STRATEGY: recursive
SHOPTS: "-o StrictHostKeyChecking=no"
before_script:
- export PATH="$CARGO_HOME/bin:$PATH"
build-json-api:
# Literally so expensive that I realy just don't wanna deal with it
stage: build
only:
refs:
- master
changes:
- json-api/Cargo.*
- json-api/src/*
- json-api/src/testing/*
- json-api/migrations/**/*
- json-api/client-tests/**/*
- json-api/build.sh
- json-api/db/Cargo.*
- json-api/db/src/*
script:
- cd json-api/
- cargo build --release
# primarily used to cache between jobs
# expirey time overwritten later for weekly builds
artifacts:
paths:
- json-api/target/
- $CARGO_HOME
expire_in: 15 mins
test-json-api:
stage: test
needs:
- build-json-api
only:
refs:
- master
changes:
- json-api/Cargo.*
- json-api/src/*
- json-api/src/testing/*
- json-api/migrations/**/*
- json-api/client-tests/**/*
- json-api/build.sh
- json-api/db/Cargo.*
- json-api/db/src/*
dependencies:
- build-json-api
script:
- cd json-api/
- cargo test --release
artifacts:
paths:
- json-api/target/release/json-api
expire_in: 1 week
name: json-api
build-channer:
stage: build
only:
refs:
- master
changes:
- chan-like/Cargo.*
- chan-like/src/main.rs
script:
- cd chan-like/
- cargo build --release
artifacts:
paths:
- json-api/target/
- $CARGO_HOME
expire_in: 1 week
build-wiki:
image: shockrah/website:latest
only: [ "master" ]
stage: build
only:
refs:
- master
changes:
- docs/archetypes/*
- docs/content/**/*
- docs/layouts/partials/*
- docs/config.toml
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | ssh-add - > /dev/null
- mkdir -p ~/.ssh/
- chmod 700 ~/.ssh/
script:
- cd docs/
- hugo
- ssh $SHOPTS web@shockrah.xyz "rm -rf /var/www/freechat"
- scp $SHOPTS -r public/ web@shockrah.xyz:/var/www/freechat