Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Added initial build and upload workflow #13431

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/build_magma_dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: "Build Nettle and Upload to Artifactory"
on:
workflow_dispatch:
inputs:
repo:
description: 'Artifactory Repository'
required: false
default: 'debian-test'
distribution:
description: 'Distribution'
required: false
default: 'focal-ci'
dry_run:
description: 'Dry Run (only preview all files that would be uploaded)'
required: true
default: true

env:
MAGMA_PACKAGE_DIR: /home/runner/magma-packages
LIBNETTLE_PATH: /usr/lib/libnettle.so
ARTIFACTORY_URL: https://artifactory.magmacore.org:443/artifactory/

jobs:
build_deps:
runs-on: ubuntu-20.04
if: contains('["maxhbr", "nstng", "Neudrino", "tmdzk", "alexzurbonsen", "MoritzThomasHuebner"]', github.actor)
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
- name: Install fpm
shell: bash
run: |
sudo apt update
sudo apt install -y ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm
- name: Build nettle
shell: bash
run: |
mkdir -p ${MAGMA_PACKAGE_DIR}
cd third_party/build
./build.py nettle --no-install
cp *.deb $MAGMA_PACKAGE_DIR
- name: Testing if .deb file can be installed
shell: bash
run: |
sudo apt install -y ${MAGMA_PACKAGE_DIR}/*.deb
- name: Testing is libnettle.so exists.
shell: bash
run: |
if test -f "$LIBNETTLE_PATH"; then
echo "$LIBNETTLE_PATH exists."
else
echo "$LIBNETTLE_PATH does not exist. Build failed. Exiting..."
exit 2
fi
- name: Upload zipped nettle.deb to Github
uses: actions/upload-artifact@v3
with:
name: nettle
path: ${{ env.MAGMA_PACKAGE_DIR }}
- name: Setup JFROG CLI
uses: jfrog/setup-jfrog-cli@v2
env:
JF_ENV_1: ${{ secrets.JFROG_TOKEN }}
- name: Set dry run environment variable
id: is_dry
if: ${{ github.event.inputs.dry_run == 'true' }}
run: |
echo "IS_DRY=--dry-run" >> $GITHUB_ENV
- name: Publish debian packages
run: |
jf rt u \
--recursive=false \
--url=${ARTIFACTORY_URL} \
--detailed-summary \
${{ env.IS_DRY }} \
--target-props="deb.distribution=${{ github.event.inputs.distribution }};deb.component=main;deb.architecture=amd64" \
"~/magma-packages/(*).deb" ${{ github.event.inputs.repo }}/pool/${{ github.event.inputs.distribution }}/{1}.deb