forked from awsassets/linux-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build, test and create packages for deb, rpm and arch
- Loading branch information
Alexandru Cheltuitor
committed
Dec 29, 2020
1 parent
3e88d4d
commit 5a25786
Showing
17 changed files
with
589 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,132 @@ | ||
# Jobs to build debian packages | ||
# Jobs to build and publish deb, rpm and arch based packages | ||
include: | ||
- project: 'ProtonVPN/Linux/_gitlab-ci' | ||
ref: public-protonvpn-repo | ||
file: 'gitlab-ci-build-publish-debian.yml' | ||
|
||
- project: 'ProtonVPN/Linux/_gitlab-ci' | ||
ref: public-protonvpn-repo | ||
file: 'gitlab-ci-build-publish-debian.yml' | ||
- project: 'ProtonVPN/Linux/_gitlab-ci' | ||
ref: public-protonvpn-repo | ||
file: 'gitlab-ci-build-publish-rpm.yml' | ||
- project: 'ProtonVPN/Linux/_gitlab-ci' | ||
ref: public-protonvpn-repo | ||
file: 'gitlab-ci-build-publish-arch.yml' | ||
- project: 'agarroux/publish-github' | ||
ref: master | ||
file: '/jobs/release.gitlab-ci.yml' | ||
|
||
default: | ||
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG | ||
|
||
stages: | ||
- build | ||
- publish | ||
- message | ||
- image | ||
- test | ||
- build | ||
- publish | ||
- message | ||
- image-latest | ||
- release | ||
|
||
variables: | ||
CI_REGISTRY_IMAGE_PROTON: "$CI_REGISTRY/infra/kubernetes/images" | ||
PKGNAME_ARCH: "protonvpn-cli" | ||
PKGNAME_RPM: "protonvpn-cli" | ||
ORIGINAL_PKGNAME: "protonvpn-cli" | ||
|
||
|
||
######## Manage the Image ########## | ||
.common-image: | ||
image: $CI_REGISTRY/infra/kubernetes/images/docker:stable | ||
interruptible: true | ||
variables: | ||
DOCKER_HOST: tcp://docker:2375 | ||
services: | ||
- name: $CI_REGISTRY/infra/kubernetes/images/docker:dind | ||
alias: docker | ||
before_script: | ||
- apk update | ||
- apk add make bash git gawk rsync | ||
|
||
## Make image when we push to a branch -> run tests on top of this one | ||
make-image-deb: | ||
stage: image | ||
extends: .common-image | ||
except: | ||
- schedules | ||
- triggers | ||
script: | ||
- make image-deb branch=$CI_COMMIT_REF_SLUG src=ubuntu | ||
|
||
make-image-rpm: | ||
stage: image | ||
extends: make-image-deb | ||
script: | ||
- make image-rpm branch=$CI_COMMIT_REF_SLUG src=fedora | ||
|
||
make-image-arch: | ||
stage: image | ||
extends: make-image-deb | ||
script: | ||
- make image-arch branch=$CI_COMMIT_REF_SLUG src=archlinux | ||
|
||
## Once the CI is green, we retag the current branch-master to latest | ||
publish-latest-deb: | ||
stage: image-latest | ||
extends: .common-image | ||
dependencies: [] # Prevent download + extract artifacts | ||
only: | ||
- master | ||
except: | ||
- schedules | ||
- triggers | ||
script: | ||
- make latest src=ubuntu | ||
|
||
publish-latest-rpm: | ||
extends: publish-latest-deb | ||
script: | ||
- make latest src=fedora | ||
|
||
publish-latest-arch: | ||
extends: publish-latest-deb | ||
script: | ||
- make latest src=archlinux | ||
|
||
|
||
######## CI Jobs ########## | ||
test-deb: | ||
stage: test | ||
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-ubuntu | ||
interruptible: true | ||
needs: | ||
- job: make-image-deb | ||
script: | ||
- python3 -m pytest | ||
|
||
test-rpm: | ||
extends: test-deb | ||
needs: | ||
- job: make-image-rpm | ||
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-fedora | ||
|
||
test-arch: | ||
extends: test-deb | ||
needs: | ||
- job: make-image-arch | ||
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-archlinux | ||
|
||
|
||
## Jobs to publish commits + tags from master to github | ||
# release-publish-github: | ||
# stage: release | ||
# variables: | ||
# RELEASE_SYNC_PUBLIC_URL: [email protected]:repo-username/repo-name.git | ||
# RELEASE_SYNC_TO_BRANCH: 'master' | ||
# RELEASE_SYNC_FROM_BRANCH: 'master' | ||
# extends: .release-sync-commit-shared | ||
|
||
# release-publish-github-tags: | ||
# stage: release | ||
# variables: | ||
# RELEASE_SYNC_PUBLIC_URL: [email protected]:repo-username/repo-name.git | ||
# RELEASE_SYNC_TO_BRANCH: 'master' | ||
# RELEASE_SYNC_FROM_BRANCH: 'master' | ||
# extends: .release-sync-tags-shared |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM IMAGE_URL_ARCH | ||
ARG pkgname | ||
ENV pkgname=${pkgname:-protonvpn-cli} | ||
RUN pacman -Syu --noconfirm | ||
|
||
RUN pacman -S --noconfirm \ | ||
gcc \ | ||
sudo \ | ||
pacman-contrib \ | ||
base-devel \ | ||
networkmanager \ | ||
networkmanager-openvpn \ | ||
openvpn \ | ||
make \ | ||
python \ | ||
python-pip \ | ||
bash \ | ||
vim \ | ||
nano \ | ||
namcap \ | ||
dbus \ | ||
libnm \ | ||
gnome-keyring \ | ||
# gobject-introspection \ | ||
# pkgconf \ | ||
libsecret | ||
|
||
RUN pacman -S --noconfirm \ | ||
python-pyxdg \ | ||
python-keyring \ | ||
python-distro \ | ||
python-jinja \ | ||
python-gobject \ | ||
python-pythondialog | ||
|
||
RUN python3 -m pip install proton-client && \ | ||
python3 -m pip install --upgrade sentry-sdk==0.10.2 | ||
|
||
RUN pacman -S --noconfirm \ | ||
python-pytest \ | ||
python-pytest-cov | ||
|
||
RUN useradd -ms /bin/bash user | ||
RUN usermod -a -G wheel user | ||
RUN usermod -a -G network user | ||
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
COPY docker_entry_arch.sh /usr/local/bin | ||
COPY . /home/user/$pkgname | ||
|
||
RUN chown -R user:user /home/user/ | ||
WORKDIR /home/user/$pkgname | ||
|
||
USER user | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker_entry_arch.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM IMAGE_URL_DEB | ||
ARG pkgname | ||
ENV pkgname=${pkgname:-protonvpn-cli} | ||
RUN apt-get update | ||
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata | ||
|
||
# Install a few useful packages | ||
|
||
RUN apt-get install -y net-tools \ | ||
apt-utils \ | ||
iproute2 \ | ||
python3 \ | ||
python3-pip \ | ||
network-manager \ | ||
network-manager-openvpn \ | ||
sudo \ | ||
vim \ | ||
pkg-config \ | ||
iputils-ping \ | ||
openvpn \ | ||
libsecret-tools \ | ||
dbus-x11 \ | ||
gnome-keyring \ | ||
libgirepository1.0-dev \ | ||
gir1.2-nm-1.0 \ | ||
libcairo2-dev | ||
|
||
RUN apt-get install -y \ | ||
python3-xdg \ | ||
python3-keyring \ | ||
python3-distro \ | ||
python3-jinja2 \ | ||
python3-dialog | ||
|
||
RUN apt-get install -y \ | ||
python3-pytest \ | ||
python3-pytest-cov | ||
|
||
RUN python3 -m pip install proton-client && \ | ||
python3 -m pip install --upgrade sentry-sdk==0.10.2 | ||
|
||
RUN useradd -ms /bin/bash user | ||
RUN usermod -a -G sudo user | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
COPY docker_entry_deb.sh /usr/local/bin | ||
COPY . /home/user/$pkgname | ||
|
||
RUN chown -R user:user /home/user/$pkgname | ||
WORKDIR /home/user/$pkgname | ||
|
||
USER user | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker_entry_deb.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
FROM IMAGE_URL_RPM | ||
ARG pkgname | ||
ENV pkgname=${pkgname:-protonvpn-cli} | ||
RUN dnf update -y | ||
|
||
# Install a few useful packages | ||
|
||
RUN dnf install -y net-tools \ | ||
gcc \ | ||
sudo \ | ||
rpm-build \ | ||
rpm-devel \ | ||
rpmlint \ | ||
rpmdevtools \ | ||
rpm-sign \ | ||
python3 \ | ||
python3-pip \ | ||
NetworkManager \ | ||
NetworkManager-openvpn \ | ||
sudo \ | ||
vim \ | ||
nano \ | ||
pkg-config \ | ||
openvpn \ | ||
openssl-devel \ | ||
openssl-libs \ | ||
dbus-x11 \ | ||
gnome-keyring \ | ||
libsecret \ | ||
gtk3 \ | ||
polkit | ||
|
||
RUN dnf install -y \ | ||
python3-pyxdg \ | ||
python3-dbus \ | ||
python3-keyring \ | ||
python3-distro \ | ||
python3-gobject \ | ||
python3-jinja2 \ | ||
python3-dialog | ||
|
||
RUN python3 -m pip install proton-client && \ | ||
python3 -m pip install --upgrade sentry-sdk==0.10.2 | ||
|
||
RUN dnf install -y \ | ||
python3-pytest \ | ||
python3-pytest-cov | ||
|
||
RUN useradd -ms /bin/bash user | ||
RUN usermod -a -G wheel user | ||
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
COPY docker_entry_rpm.sh /usr/local/bin | ||
COPY . /home/user/$pkgname | ||
|
||
RUN chown -R user:user /home/user/$pkgname | ||
WORKDIR /home/user/$pkgname | ||
|
||
USER user | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker_entry_rpm.sh"] |
Oops, something went wrong.