summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: f71e2d775955fd15ca0b8a29df15b0f170f8f905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

# Rust caching causing bloat and using too much disk space in public gitlab.com
# CI process
#cache:
#  key: "${CI_COMMIT_REF_SLUG}"
#  paths:
#    - python/.venv/
#    - rust/target/
#    - rust/.cargo_cache/

variables:
  LC_ALL: "C.UTF-8"
  LANG: "C.UTF-8"
  PIPENV_VENV_IN_PROJECT: "true"
  CARGO_HOME: ".cargo_cache"

image: "bnewbold/fatcat-test-base:focal"

unified_test:
  variables:
    POSTGRES_DB: "fatcat_test"
    POSTGRES_USER: "fatcat_user"
    POSTGRES_PASSWORD: "fatcat_pw"
    DATABASE_URL: "postgres://fatcat_user:fatcat_pw@postgres/fatcat_test"
    TEST_DATABASE_URL: "postgres://fatcat_user:fatcat_pw@postgres/fatcat_test"
  services:
    - "postgres:11"
  before_script:
    - export PATH="$PATH:$CARGO_HOME/bin"
    - apt update -qy
    - >
        apt install -y
        software-properties-common wget pkg-config git
        libpq-dev libsnappy-dev libsodium-dev
        rustc cargo
        python3.8 python3.8-dev python3.8-venv python3.8-distutils
        python3-dev python3-pip python3-wheel python3-requests python3-six python3-pytest pipenv
    - diesel --version || cargo install diesel_cli --version 1.3.1 --no-default-features --features postgres
    - wget --continue https://archive.org/download/ia-deb-pkgs/pipenv_11.15-0ia1_all.deb
    - apt install ./pipenv_11.15-0ia1_all.deb
    - pipenv --version
  script:
    - rustc --version && cargo --version && diesel --version
    - cd rust
    - cp example.env .env
    - diesel database reset && diesel migration run
    - cargo build
    - df -h
    - df -i
    - cargo test -- --test-threads 1
    - cargo run --bin fatcatd &
    - cd ../python_openapi_client
    # TODO: - pytest-3
    - cd ../python
    - cp example.env .env
    - pipenv install --dev --deploy
    - df -h
    - df -i
    - pipenv run pytest --cov
    - pipenv run ./tests/cli.sh
    # Just errors
    - pipenv run pylint -E fatcat*.py fatcat_tools fatcat_web tests/*.py
    - pipenv run flake8 tests/ fatcat_web/ fatcat_tools/ *.py --count --select=E9,F63,F7,F82 --show-source --statistics

rust_build_release:
  stage: build
  when: manual
  before_script:
    - export PATH="$PATH:$CARGO_HOME/bin"
    - apt update -qy
    - >
        apt install -y
        software-properties-common wget pkg-config git
        libpq-dev libsnappy-dev libsodium-dev
        rustc cargo
        python3-dev python3-pip python3-wheel python3-requests python3-six python3-pytest
  script:
    - rustc --version && cargo --version
    - cd rust
    - ./build_tarball.sh
  artifacts:
    paths:
    - rust/fatcat-rust.tar.gz
    expire_in: 1 year

python_build_release:
  stage: build
  when: manual
  before_script:
    - apt update -qy
    - >
        apt install -y
        software-properties-common wget pkg-config git
        libpq-dev libsnappy-dev libsodium-dev
        rustc cargo
        python3.8 python3.8-dev python3.8-venv python3.8-distutils
        python3-dev python3-pip python3-wheel python3-requests python3-six python3-pytest pipenv
  script:
    - python3 --version
    - pipenv --version
    - cd python
    - ./build_tarball.sh
  artifacts:
    paths:
    - python/fatcat-python.tar.gz
    expire_in: 1 year