Deploy to Gitlab Pages ls !2

This commit is contained in:
Felipe M 2019-10-07 19:13:11 +02:00
parent 12d6e3824c
commit a93444b064
Signed by: fmartingr
GPG key ID: 716BC147715E716F
6 changed files with 38 additions and 15 deletions

36
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,36 @@
image: archlinux/base:latest
variables:
POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/poetry"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
before_script:
- pacman -Syu python-pip nodejs npm make --noconfirm
cache:
paths:
- .cache/pip
- .cache/poetry
stages:
- deploy
pages:
stage: deploy
script:
- pip install -r requirements.txt
- npm install
- make build
artifacts:
paths:
- public
only:
- master
pages_test:
stage: deploy
script:
- pip install requests
- python -m unittest tests.tests_deploy
only:
- master

View file

@ -14,10 +14,5 @@ build:
watch: watch:
node_modules/gulp/bin/gulp.js sass:watch node_modules/gulp/bin/gulp.js sass:watch
deploy:
make build
rm -rf ${PWD}/public/.lektor
rclone sync --progress --create-empty-src-dirs ${PWD}/public fastmail:fmartingr.com
deploy_tests: deploy_tests:
bash tests/run.sh bash tests/run.sh

View file

@ -33,7 +33,7 @@
<footer class="center text-center"> <footer class="center text-center">
<hr class="light"> <hr class="light">
<div> <div>
Powered by <a href="https://www.getlektor.com/" target="_blank">Lektor</a>. Powered by <a href="https://www.getlektor.com/" target="_blank">Lektor</a> and <a href="https://about.gitlab.com/product/pages/">Gitlab Pages</a>.
</div> </div>
<div> <div>
<a target="_blank" href="mailto:me@fmartingr.com">E-Mail</a> <a target="_blank" href="mailto:me@fmartingr.com">E-Mail</a>

View file

@ -1 +0,0 @@
requests

View file

@ -1,6 +0,0 @@
#!/bin/bash
virtualenv -p python3 tests/venv
source tests/venv/bin/activate
pip install -r tests/requirements.txt
python -m unittest tests.tests_deploy

View file

@ -1,9 +1,8 @@
import unittest import unittest
import requests import requests
class DeployTestCase(unittest.TestCase): class PagesTestCase(unittest.TestCase):
def test_http_redirect_to_https(self): def test_http_redirect_to_https(self):
result = requests.get('http://fmartingr.com', allow_redirects=False) result = requests.get('http://fmartingr.com', allow_redirects=False)
self.assertEqual(result.status_code, 301) self.assertEqual(result.status_code, 301)