-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
94 lines (87 loc) · 2.77 KB
/
.gitlab-ci.yml
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
image: debian:bookworm-slim
stages:
- test
- release
# Debian preparation: install utilities and PHP modules needed for building the project
.debian-build:
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -yqq
- apt-get install -yqq git make composer curl sed librsvg2-bin netpbm php-xdebug php-sqlite3 php-curl php-xml php-mbstring php-json php-zip php-intl
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}"
# Test job: run all tests defined in Composer
# Exports Cobertura coverage report
test-job:
stage: test
extends: .debian-build
script:
- composer update
- composer tests
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: .coverage/cobertura.xml
untracked: false
when: on_success
expire_in: 30 days
# Build job: build application package and release info, publish it in generic package registry
# This runs only on version tags
# Exports application package and release changes summary
build-job:
stage: release
extends: .debian-build
rules:
- if: $CI_COMMIT_TAG =~ /^v[\d.]+/
script:
- composer update --no-dev
- ./generate-icon.sh
- make appstore
- ./generate-relinfo.sh
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file build/artifacts/appstore/calibre_opds.tar.gz "${PACKAGE_REGISTRY_URL}/calibre_opds.tar.gz"
artifacts:
paths:
- build/artifacts/appstore/calibre_opds.tar.gz
- build/relinfo.md
untracked: false
when: on_success
expire_in: 30 days
# Release job: publish a GitLab release
# This runs only on version tags
release-job:
stage: release
needs:
- job: build-job
artifacts: true
rules:
- if: $CI_COMMIT_TAG =~ /^v[\d.]+/
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo "Running the release job"
release:
tag_name: $CI_COMMIT_TAG
description: ./build/relinfo.md
assets:
links:
- name: App tarball
url: "${PACKAGE_REGISTRY_URL}/calibre_opds.tar.gz"
link_type: package
# Release mirror job: publish a GitHub release
# This runs only on version tags -- disabled for now, since GitLab doesn't have secrets storage
# Needs variables: GH_TOKEN (GitHub API token), GH_REPO (GitHub repository name)
#release-mirror-job:
# stage: release
# needs:
# - job: build-job
# artifacts: true
# rules:
# - if: $CI_COMMIT_TAG =~ /^v[\d.]+/
# before_script:
# - export DEBIAN_FRONTEND=noninteractive
# - apt-get update -yqq
# - apt-get install -yqq gh ca-certificates
# script:
# - |
# gh release create ci-test -t "ci-test" -F ./build/relinfo.md "./build/artifacts/appstore/calibre_opds.tar.gz#App tarball" -R "$GH_REPO"