-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement CI on the base of Github Actions
- Loading branch information
Showing
9 changed files
with
155 additions
and
142 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,26 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ main, devel, github-workflows] | ||
pull_request: | ||
branches: [ main, devel ] | ||
|
||
jobs: | ||
run_build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install git | ||
run: | | ||
sudo apt-get update -q | ||
sudo apt-get install -y git | ||
- name: Run tests | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
./.github/workflows/scripts/run-build.sh |
File renamed without changes.
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,41 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
LOGFILE="/var/globaleaks/log/globaleaks.log" | ||
ACCESSLOG="/var/globaleaks/log/access.log" | ||
|
||
function atexit { | ||
if [[ -f $LOGFILE ]]; then | ||
cat $LOGFILE | ||
fi | ||
|
||
if [[ -f $ACCESSLOG ]]; then | ||
cat $ACCESSLOG | ||
fi | ||
} | ||
|
||
trap atexit EXIT | ||
|
||
sudo apt-get install -y debootstrap | ||
|
||
export chroot="/tmp/globaleaks_chroot/" | ||
sudo mkdir -p "$chroot/build" | ||
sudo cp -R $GITHUB_WORKSPACE/ "$chroot/build" | ||
export LC_ALL=en_US.utf8 | ||
export DEBIAN_FRONTEND=noninteractive | ||
sudo -E ls "$chroot/build" -al | ||
sudo -E debootstrap --arch=amd64 bookworm "$chroot" http://deb.debian.org/debian/ | ||
sudo -E su -c 'echo "deb http://deb.debian.org/debian bookworm main contrib" > /tmp/globaleaks_chroot/etc/apt/sources.list' | ||
sudo -E su -c 'echo "deb http://deb.debian.org/debian bookworm main contrib" >> /tmp/globaleaks_chroot/etc/apt/sources.list' | ||
sudo -E mount --rbind /proc "$chroot/proc" | ||
sudo -E mount --rbind /sys "$chroot/sys" | ||
sudo -E chroot "$chroot" apt-get update -y | ||
sudo -E chroot "$chroot" apt-get upgrade -y | ||
sudo -E chroot "$chroot" apt-get install -y lsb-release locales sudo | ||
sudo -E su -c 'echo "en_US.UTF-8 UTF-8" >> /tmp/globaleaks_chroot/etc/locale.gen' | ||
sudo -E chroot "$chroot" locale-gen | ||
sudo -E chroot "$chroot" useradd -m builduser | ||
sudo -E su -c 'echo "builduser ALL=NOPASSWD: ALL" >> "$chroot"/etc/sudoers' | ||
sudo -E chroot "$chroot" chown builduser -R /build | ||
sudo -E chroot "$chroot" su - builduser /bin/bash -c '/build/GlobaLeaks/.github/workflows/scripts/build_and_install.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,55 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
LOGFILE="$GITHUB_WORKSPACE/backend/workingdir/log/globaleaks.log" | ||
ACCESSLOG="$GITHUB_WORKSPACE/backend/workingdir/log/access.log" | ||
|
||
function atexit { | ||
if [[ -f $LOGFILE ]]; then | ||
cat $LOGFILE | ||
fi | ||
|
||
if [[ -f $ACCESSLOG ]]; then | ||
cat $ACCESSLOG | ||
fi | ||
} | ||
|
||
trap atexit EXIT | ||
|
||
setupClientDependencies() { | ||
cd $GITHUB_WORKSPACE/client # to install frontend dependencies | ||
npm install | ||
grunt instrument-client | ||
} | ||
|
||
setupBackendDependencies() { | ||
cd $GITHUB_WORKSPACE/backend # to install backend dependencies | ||
pip3 install -r requirements/requirements-$(lsb_release -cs).txt | ||
} | ||
|
||
setupDependencies() { | ||
setupClientDependencies | ||
setupBackendDependencies | ||
} | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y tor | ||
npm install -g grunt grunt-cli | ||
|
||
pip install coverage | ||
|
||
echo "Running backend unit tests" | ||
setupDependencies | ||
cd $GITHUB_WORKSPACE/backend && coverage run setup.py test | ||
|
||
$GITHUB_WORKSPACE/backend/bin/globaleaks -z | ||
sleep 5 | ||
|
||
echo "Running BrowserTesting locally collecting code coverage" | ||
cd $GITHUB_WORKSPACE/client && npm test | ||
|
||
cd $GITHUB_WORKSPACE/backend && coverage xml | ||
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r $GITHUB_WORKSPACE/backend/coverage.xml | ||
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Javascript -r $GITHUB_WORKSPACE/client/cypress/coverage/lcov.info | ||
bash <(curl -Ls https://coverage.codacy.com/get.sh) final |
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,29 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main, devel, github-workflows] | ||
pull_request: | ||
branches: [ main, devel ] | ||
|
||
env: | ||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
|
||
jobs: | ||
run_tests: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install git | ||
run: | | ||
sudo apt-get update -q | ||
sudo apt-get install -y git | ||
- name: Run tests | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
./.github/workflows/scripts/run-tests.sh |
This file was deleted.
Oops, something went wrong.
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
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
This file was deleted.
Oops, something went wrong.