-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from chylli-deriv/refactor/auto-compile
Refactor/auto compile
- Loading branch information
Showing
4 changed files
with
81 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
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,50 @@ | ||
name: Build workflow | ||
run-name: Build workflow | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'master' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # Maybe here is a blocker | ||
container: | ||
image: debian:bullseye | ||
defaults: | ||
run: | ||
shell: bash -le {0} | ||
env: | ||
BRANCH: ${{ github.ref_name }} | ||
steps: | ||
- name: prepare | ||
|
||
run: | | ||
apt-get update | ||
apt-get -y dist-upgrade | ||
apt-get -y install locales build-essential gettext libpq5 libpq-dev make gcc git openssh-client curl wget sudo lsb-release socat redis-server cmake | ||
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen | ||
locale-gen | ||
if [[ ! $BRANCH =~ perl-[0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
echo "Error: Branch name must be perl-<version>" | ||
exit 1 | ||
fi | ||
VERSION=$(echo $BRANCH | sed -e 's/.*perl-\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/') | ||
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV | ||
git config --global user.email "cibot@deriv.com" | ||
git config --global user.name "ci bot" | ||
git config --global --add safe.directory $PWD # ignore ownership problem | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4 | ||
- name: compile | ||
run: | | ||
bash ./rebuild.sh | ||
- name: push | ||
run: | | ||
rm -rf lib bin man | ||
mv /home/git/binary-com/perl/{bin,lib} . | ||
git add lib bin | ||
git commit -m "[ci skip] compile $VERSION" | ||
git push origin HEAD:$BRANCH |
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,14 +1,19 @@ | ||
# perl | ||
Custom compiled perl for Binary.com | ||
|
||
# compiling steps | ||
Custom compiled perl for deriv.com | ||
|
||
Download source code from http://www.cpan.org/src/5.0/perl-5.26.2.tar.gz | ||
## compiling steps | ||
|
||
We defined `-Dusesitecustomize` and removed `-Dusethreads`. Most of other parameters are copied from `perl -V | grep config_args` | ||
Run following command: | ||
``` | ||
./Configure -Dusesitecustomize -Dinc_version_list=none -Dprefix=/home/git/binary-com/perl -Dvendorprefix=/home/git/regentmarkets/cpan/local -Dvendorlib=/home/git/regentmarkets/cpan/local/lib/perl5 -Dvendorarch=/home/git/regentmarkets/cpan/local/lib/perl5/x86_64-linux -Duselargefiles -Dccflags="-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" -Dldflags=" -Wl,-z,relro" -Dlddlflags="-shared -Wl,-z,relro" -Dcccdlflags="-fPIC" -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Uuseithreads -Uusemultiplicity -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -des | ||
make | ||
make install | ||
```bash | ||
VERSION=5.26.2 ./rebuild.sh | ||
``` | ||
|
||
## compiling it with CI | ||
|
||
1. enable CI test in your forked repo : | ||
at https://github.com/username/perl/settings/actions set `Allow all actions and reusable workflows` | ||
and `Read and write permissions`. Don't forget to click `save` at both section. | ||
2. Or create a new branch directly on binary-com/perl repo | ||
3. create a branch whose name include a perl version `perl-x.yy.zz`, e.g. `upgrade/perl.5.38.2` | ||
|
||
Then CI will download and compile perl and push it to your branch |
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,17 +1,24 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
wget http://www.cpan.org/src/5.0/perl-5.26.2.tar.gz | ||
rm -rf perl-5.26.2 | ||
tar xzvf perl-5.26.2.tar.gz | ||
cd perl-5.26.2 | ||
if [ -z "$VERSION" ]; then | ||
echo "No VERSION environment variable set. Exiting..." | ||
exit 1 | ||
fi | ||
echo "Building perl version $VERSION" | ||
rm -rf bin lib man | ||
wget http://www.cpan.org/src/5.0/perl-$VERSION.tar.gz | ||
rm -rf perl-$VERSION | ||
tar xzvf perl-$VERSION.tar.gz | ||
cd perl-$VERSION | ||
|
||
# Apply patch for fixing Time::Local tests entering year 2020 (CPAN RT#124787) | ||
zcat ../patches/0001-Fix-Time-Local-tests.patch.gz | patch -p1 --verbose || exit 1 | ||
|
||
# Apply patch for fixing gcc 10 problem https://github.com/openwrt/packages/pull/12178 | ||
patch -Np1 < ../patches/999-fix-build-failure-against-gcc-10.patch | ||
|
||
#We defined `-Dusesitecustomize` and removed `-Dusethreads`. Most of other parameters are copied from `perl -V | grep config_args` | ||
./Configure -Dusesitecustomize -Dinc_version_list=none -Dprefix=/home/git/binary-com/perl -Dsitelib=/home/git/regentmarkets/cpan-private/local/lib/perl5 -Dsitearch=/home/git/regentmarkets/cpan-private/local/lib/perl5/x86_64-linux -Dvendorprefix=/home/git/regentmarkets/cpan/local -Dvendorlib=/home/git/regentmarkets/cpan/local/lib/perl5 -Dvendorarch=/home/git/regentmarkets/cpan/local/lib/perl5/x86_64-linux -Duselargefiles -Dccflags="-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" -Dldflags=" -Wl,-z,relro" -Dlddlflags="-shared -Wl,-z,relro" -Dcccdlflags="-fPIC" -Duse64bitint -Dman1dir=none -Dman3dir=none -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Uuseithreads -Uusemultiplicity -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -des | ||
make && make test && make install | ||
|