Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.18 KiB
Newer Older
Augustin Lemesle's avatar
Augustin Lemesle committed
# This file is a template, and might need editing before it works on your project.
# Template project: https://gitlab.com/pages/jekyll
# Docs: https://docs.gitlab.com/ce/pages/
Augustin Lemesle's avatar
Augustin Lemesle committed
image: ruby:2.6
stages:
  - test
  - css
  - deploy
Augustin Lemesle's avatar
Augustin Lemesle committed
variables:
  JEKYLL_ENV: production

# Cache gems in between builds
cache:
  paths:
    - vendor/ruby

Frama-CI Bot's avatar
Frama-CI Bot committed
.build_template: &prepare_website_template
  before_script:
    - ruby -v                                   # Print out ruby version for debugging
    - gem install bundler -v '2.0.2'
    - bundle install -j $(nproc) --path vendor
    - curl -sL https://deb.nodesource.com/setup_15.x | bash -
    - apt-get install -y nodejs pandoc
    - cd generator
    - chmod +x ./generate
    - curl https://git.frama-c.com/api/v4/projects/780/repository/files/Changelog/raw?ref=master > ../assets/Changelog
    - curl https://git.frama-c.com/api/v4/projects/780/repository/files/src%2Fplugins%2Fe-acsl%2Fdoc%2FChangelog/raw?ref=master >> ../assets/Changelog
    - curl https://git.frama-c.com/api/v4/projects/780/repository/files/src%2Fplugins%2Fwp%2FChangelog/raw?ref=master >> ../assets/Changelog
    - ./generate ../assets/Changelog -o ../html/changelog.html
    - cd ..

git-lfs:
  stage: test
  script:
    - git lfs fsck
  tags:
    - docker
  image: datamachines/git-lfs:latest
Augustin Lemesle's avatar
Augustin Lemesle committed

test:
  stage: test
Frama-CI Bot's avatar
Frama-CI Bot committed
  <<: *prepare_website_template
Augustin Lemesle's avatar
Augustin Lemesle committed
  script:
Augustin Lemesle's avatar
Augustin Lemesle committed
  - bundle exec jekyll build -d test --future
Augustin Lemesle's avatar
Augustin Lemesle committed
  artifacts:
    paths:
    - test
Augustin Lemesle's avatar
Augustin Lemesle committed
    expire_in: 1 month
Augustin Lemesle's avatar
Augustin Lemesle committed
  except:
  - master
Augustin Lemesle's avatar
Augustin Lemesle committed
  tags:
  - docker
  stage: css
Augustin Lemesle's avatar
Augustin Lemesle committed
  dependencies:
  - test
Frama-CI Bot's avatar
Frama-CI Bot committed
  <<: *prepare_website_template
  - npm install -g purify-css
Allan Blanchard's avatar
Allan Blanchard committed
  - cat $(find test -name '*.html') > output.html
  - find assets/css/ -name '*.css' ! -name swiper.css | xargs -I % purifycss % output.html -o % --whitelist otherVersion --rejected > del-classes.o
Augustin Lemesle's avatar
Augustin Lemesle committed
  - if [ $(grep "PurifyCSS" del-classes.o | wc -l) = 0 ]; then echo "No CSS to clean"; else cat del-classes.o; exit 1; fi;
  allow_failure: true
  except:
  - master
  tags:
  - docker
Augustin Lemesle's avatar
Augustin Lemesle committed
pages:
  stage: deploy
Frama-CI Bot's avatar
Frama-CI Bot committed
  <<: *prepare_website_template
Augustin Lemesle's avatar
Augustin Lemesle committed
  script:
  - JEKYLL_ENV="production" bundle exec jekyll build -d public --future
Augustin Lemesle's avatar
Augustin Lemesle committed
  artifacts:
    paths:
    - public
Augustin Lemesle's avatar
Augustin Lemesle committed
    expire_in: 1 month
Augustin Lemesle's avatar
Augustin Lemesle committed
  tags:
  - docker