Skip to content

Commit

Permalink
feat(ci): moved ci to github actions
Browse files Browse the repository at this point in the history
sysdig-CLA-1.0-signed-off-by: Roberto Scolaro <roberto.scolaro@sysdig.com>
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo committed Aug 4, 2023
1 parent ee3b8fa commit 1ae875f
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI Build
on: [push,pull_request,workflow_dispatch]

jobs:
build-settings:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.get_settings.outputs.semver }}
version: ${{ steps.get_settings.outputs.version }}
steps:
- name: Checkout Sysdig
uses: actions/checkout@v3
- name: Get settings for this release
id: get_settings
shell: python
run: |
import os
import json
ref_name = '${{ github.ref_name }}-${{ github.run_number }}'.replace('/','-')
with open("package.json","r") as f:
v = json.load(f)['version']
version = f'{v}-{ref_name}'
semver = f'{v}'
with open(os.environ['GITHUB_OUTPUT'], 'a') as ofp:
print(f'version={version}'.lower(), file=ofp)
print(f'semver={semver}'.lower(), file=ofp)
build-sysdig-inspect:
needs: [build-settings]
env:
BUILDER: "sysdiglabs/sysdig-inspect-builder:0.2"
SEMVER: ${{ needs.build-settings.outputs.semver }}
VERSION: ${{ needs.build-settings.outputs.version }}

runs-on: ubuntu-latest
container:
image: "sysdiglabs/sysdig-inspect-builder:0.2"
env:
INSTALL_DEPS: true
GIT_BRANCH: dev
SEMVER: ${{ needs.build-settings.outputs.semver }}
VERSION: ${{ needs.build-settings.outputs.version }}
BUILD_MAC: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Sysdig
uses: actions/checkout@v3
- name: install 7z
run: |
cd /tmp
sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf &&
update-ca-certificates -f &&
curl -L -o 7z.tar.xz https://www.7-zip.org/a/7z2301-linux-x64.tar.xz &&
tar -xaf 7z.tar.xz &&
mv 7zz /usr/bin/7z &&
rm -vfr /tmp/* &&
cd -
- name: Build sysdig-inspect
run: ./build/build.sh
- name: Upload artifacts rpm
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-${{ env.VERSION }}-linux-x86_64.rpm
path: |
out/linux/installers/sysdig-inspect-linux-x86_64.rpm
- name: Upload artifacts deb
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-${{ env.VERSION }}-linux-x86_64.deb
path: |
out/linux/installers/sysdig-inspect-linux-x86_64.deb
- name: Upload artifacts dmg
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-${{ env.VERSION }}-mac-x86_64.dmg
path: |
out/mac/binaries/sysdig-inspect-${{ env.SEMVER }}-mac-86_64.dmg
- name: Upload artifacts zip
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-${{ env.VERSION }}-mac-x86_64.zip
path: |
out/mac/binaries/sysdig-inspect-mac-x86_64.zip
95 changes: 95 additions & 0 deletions .github/workflows/release-draft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Create sysdig-inspect draft/RC release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[a-z]+'
- '[0-9]+.[0-9]+.[0-9]+-[a-z]+[0-9]+'
permissions:
contents: write

jobs:
build-sysdig-inspect:
env:
BUILDER: "sysdiglabs/sysdig-inspect-builder:0.2"
VERSION: ${{ github.ref_name }}

runs-on: ubuntu-latest
container:
image: "sysdiglabs/sysdig-inspect-builder:0.2"
env:
INSTALL_DEPS: true
GIT_BRANCH: ${{ github.ref_name }}
VERSION: ${{ github.ref_name }}
BUILD_MAC: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Sysdig
uses: actions/checkout@v3
- name: install 7z
run: |
cd /tmp
sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf &&
update-ca-certificates -f &&
curl -L -o 7z.tar.xz https://www.7-zip.org/a/7z2301-linux-x64.tar.xz &&
tar -xaf 7z.tar.xz &&
mv 7zz /usr/bin/7z &&
rm -vfr /tmp/* &&
cd -
- name: Build sysdig-inspect
run: ./build/build.sh
- name: Upload artifacts rpm
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.rpm
path: |
out/linux/installers/sysdig-inspect-linux-x86_64.rpm
- name: Upload artifacts deb
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.deb
path: |
out/linux/installers/sysdig-inspect-linux-x86_64.deb
- name: Upload artifacts dmg
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.dmg
path: |
out/mac/binaries/sysdig-inspect-${{ env.VERSION }}-mac-x86_64.dmg
- name: Upload artifacts zip
uses: actions/upload-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.zip
path: |
out/mac/binaries/sysdig-inspect-mac-x86_64.zip
create-draft-release:
runs-on: ubuntu-latest
needs: [build-sysdig-inspect]
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Download artifacts (linux-amd64 deb)
uses: actions/download-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.deb
- name: Download artifacts (linux-amd64 rpm)
uses: actions/download-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.rpm
- name: Download artifacts (osx-amd64)
uses: actions/download-artifact@v3
with:
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.zip
- name: test
run: ls -lah /home/runner/work/sysdig-inspect/sysdig-inspect/
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
files: |
sysdig-inspect-linux*
sysdig-inspect-mac*
sysdig-inspect-win*
draft: true
generate_release_notes: true

0 comments on commit 1ae875f

Please sign in to comment.