~sirn/fanboi2

ref: 7e5625e958870371bd97c96aa766f8f54476f6e8 fanboi2/.builds/freebsd.yml -rw-r--r-- 2.1 KiB View raw
7e5625e9Kridsada Thanabulpong [build] create venv before building 10 months ago
                                                                                
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
image: freebsd/latest
packages:
  - node8
  - npm-node8
  - postgresql10-client
  - postgresql10-server
  - py36-pip
  - py36-sqlite3
  - python3
  - python36
sources:
  - https://git.sr.ht/~sirn/fanboi2
secrets:
  - 1628f803-8887-41bc-9044-d8e909dcc77b
environment:
  deploy_ref: refs/heads/master
  deploy_repo: https://git.sr.ht/~sirn/fanboi2
tasks:
  - setup: |
      cd fanboi2/ || exit 1
      export VENV=$HOME/venv
      export PATH=$VENV/bin:$PATH

      python3 -m venv "$VENV"
      pip install -q poetry
      poetry install

      npm install
      npm run gulp
  - test: |
      cd fanboi2/ || exit 1
      export VENV=$HOME/venv
      export PATH=$VENV/bin:$PATH

      sudo service postgresql oneinitdb
      sudo sysrc postgresql_enable=YES
      sudo sysrc postgresql_flags="-l /var/log/postgresql.log"
      (
        printf "local all all trust\\n"
        printf "host all all 127.0.0.1/32 trust\\n"
        printf "host all all ::1/128 trust\\n"
      ) | sudo tee /var/db/postgres/data10/pg_hba.conf

      sudo touch /var/log/postgresql.log
      sudo chown postgres /var/log/postgresql.log
      sudo service postgresql start
      trap "sudo service postgresql stop" 0 1 2 3 6 14 15
      sudo -u postgres createuser -ds fanboi2
      sudo -u postgres createdb -U fanboi2 fanboi2_test

      export POSTGRESQL_TEST_DATABASE="postgresql://fanboi2:@localhost:5432/fanboi2_test"
      poetry run nose2 --verbose --with-coverage
  - build: |
      cd fanboi2/ || exit 1
      export VENV=$HOME/venv
      export PATH=$VENV/bin:$PATH

      poetry build --format=sdist
      tar -tvzf dist/fanboi2-*.tar.gz

      local_ref=$(git rev-parse HEAD)
      remote_ref=$(git ls-remote $deploy_repo $deploy_ref | awk '{ print $1 }')

      if [ "$local_ref" != "$remote_ref" ]; then
        complete-build
      fi
  - deploy: |
      cd fanboi2/ || exit 1
      export VENV=$HOME/venv
      export PATH=$VENV/bin:$PATH

      poetry install --extras=deploy
      poetry run fbdeploy \
        --path=/srv/fanboi2 \
        --user=fanboi2 \
        --postcmd=/srv/fanboi2/postcmd \
        --port=4022 \
        $(host -t A app.targets.fanboi.ch | awk '{ print $4 }')