Skip to content

Commit 1ae875f

Browse files
committed
feat(ci): moved ci to github actions
sysdig-CLA-1.0-signed-off-by: Roberto Scolaro <[email protected]> Signed-off-by: Roberto Scolaro <[email protected]>
1 parent ee3b8fa commit 1ae875f

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI Build
2+
on: [push,pull_request,workflow_dispatch]
3+
4+
jobs:
5+
build-settings:
6+
runs-on: ubuntu-latest
7+
outputs:
8+
semver: ${{ steps.get_settings.outputs.semver }}
9+
version: ${{ steps.get_settings.outputs.version }}
10+
steps:
11+
- name: Checkout Sysdig
12+
uses: actions/checkout@v3
13+
- name: Get settings for this release
14+
id: get_settings
15+
shell: python
16+
run: |
17+
import os
18+
import json
19+
ref_name = '${{ github.ref_name }}-${{ github.run_number }}'.replace('/','-')
20+
with open("package.json","r") as f:
21+
v = json.load(f)['version']
22+
version = f'{v}-{ref_name}'
23+
semver = f'{v}'
24+
with open(os.environ['GITHUB_OUTPUT'], 'a') as ofp:
25+
print(f'version={version}'.lower(), file=ofp)
26+
print(f'semver={semver}'.lower(), file=ofp)
27+
28+
29+
build-sysdig-inspect:
30+
needs: [build-settings]
31+
env:
32+
BUILDER: "sysdiglabs/sysdig-inspect-builder:0.2"
33+
SEMVER: ${{ needs.build-settings.outputs.semver }}
34+
VERSION: ${{ needs.build-settings.outputs.version }}
35+
36+
runs-on: ubuntu-latest
37+
container:
38+
image: "sysdiglabs/sysdig-inspect-builder:0.2"
39+
env:
40+
INSTALL_DEPS: true
41+
GIT_BRANCH: dev
42+
SEMVER: ${{ needs.build-settings.outputs.semver }}
43+
VERSION: ${{ needs.build-settings.outputs.version }}
44+
BUILD_MAC: true
45+
volumes:
46+
- /var/run/docker.sock:/var/run/docker.sock
47+
steps:
48+
- name: Checkout Sysdig
49+
uses: actions/checkout@v3
50+
- name: install 7z
51+
run: |
52+
cd /tmp
53+
sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf &&
54+
update-ca-certificates -f &&
55+
curl -L -o 7z.tar.xz https://www.7-zip.org/a/7z2301-linux-x64.tar.xz &&
56+
tar -xaf 7z.tar.xz &&
57+
mv 7zz /usr/bin/7z &&
58+
rm -vfr /tmp/* &&
59+
cd -
60+
- name: Build sysdig-inspect
61+
run: ./build/build.sh
62+
- name: Upload artifacts rpm
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: sysdig-inspect-${{ env.VERSION }}-linux-x86_64.rpm
66+
path: |
67+
out/linux/installers/sysdig-inspect-linux-x86_64.rpm
68+
- name: Upload artifacts deb
69+
uses: actions/upload-artifact@v3
70+
with:
71+
name: sysdig-inspect-${{ env.VERSION }}-linux-x86_64.deb
72+
path: |
73+
out/linux/installers/sysdig-inspect-linux-x86_64.deb
74+
- name: Upload artifacts dmg
75+
uses: actions/upload-artifact@v3
76+
with:
77+
name: sysdig-inspect-${{ env.VERSION }}-mac-x86_64.dmg
78+
path: |
79+
out/mac/binaries/sysdig-inspect-${{ env.SEMVER }}-mac-86_64.dmg
80+
- name: Upload artifacts zip
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: sysdig-inspect-${{ env.VERSION }}-mac-x86_64.zip
84+
path: |
85+
out/mac/binaries/sysdig-inspect-mac-x86_64.zip
86+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Create sysdig-inspect draft/RC release
2+
on:
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+.[0-9]+'
6+
- '[0-9]+.[0-9]+.[0-9]+-[a-z]+'
7+
- '[0-9]+.[0-9]+.[0-9]+-[a-z]+[0-9]+'
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-sysdig-inspect:
13+
env:
14+
BUILDER: "sysdiglabs/sysdig-inspect-builder:0.2"
15+
VERSION: ${{ github.ref_name }}
16+
17+
runs-on: ubuntu-latest
18+
container:
19+
image: "sysdiglabs/sysdig-inspect-builder:0.2"
20+
env:
21+
INSTALL_DEPS: true
22+
GIT_BRANCH: ${{ github.ref_name }}
23+
VERSION: ${{ github.ref_name }}
24+
BUILD_MAC: true
25+
volumes:
26+
- /var/run/docker.sock:/var/run/docker.sock
27+
steps:
28+
- name: Checkout Sysdig
29+
uses: actions/checkout@v3
30+
- name: install 7z
31+
run: |
32+
cd /tmp
33+
sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf &&
34+
update-ca-certificates -f &&
35+
curl -L -o 7z.tar.xz https://www.7-zip.org/a/7z2301-linux-x64.tar.xz &&
36+
tar -xaf 7z.tar.xz &&
37+
mv 7zz /usr/bin/7z &&
38+
rm -vfr /tmp/* &&
39+
cd -
40+
- name: Build sysdig-inspect
41+
run: ./build/build.sh
42+
- name: Upload artifacts rpm
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.rpm
46+
path: |
47+
out/linux/installers/sysdig-inspect-linux-x86_64.rpm
48+
- name: Upload artifacts deb
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.deb
52+
path: |
53+
out/linux/installers/sysdig-inspect-linux-x86_64.deb
54+
- name: Upload artifacts dmg
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.dmg
58+
path: |
59+
out/mac/binaries/sysdig-inspect-${{ env.VERSION }}-mac-x86_64.dmg
60+
- name: Upload artifacts zip
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.zip
64+
path: |
65+
out/mac/binaries/sysdig-inspect-mac-x86_64.zip
66+
67+
create-draft-release:
68+
runs-on: ubuntu-latest
69+
needs: [build-sysdig-inspect]
70+
env:
71+
VERSION: ${{ github.ref_name }}
72+
steps:
73+
- name: Download artifacts (linux-amd64 deb)
74+
uses: actions/download-artifact@v3
75+
with:
76+
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.deb
77+
- name: Download artifacts (linux-amd64 rpm)
78+
uses: actions/download-artifact@v3
79+
with:
80+
name: sysdig-inspect-release-${{ env.VERSION }}-linux-x86_64.rpm
81+
- name: Download artifacts (osx-amd64)
82+
uses: actions/download-artifact@v3
83+
with:
84+
name: sysdig-inspect-release-${{ env.VERSION }}-mac-x86_64.zip
85+
- name: test
86+
run: ls -lah /home/runner/work/sysdig-inspect/sysdig-inspect/
87+
- name: Create draft release
88+
uses: softprops/action-gh-release@v1
89+
with:
90+
files: |
91+
sysdig-inspect-linux*
92+
sysdig-inspect-mac*
93+
sysdig-inspect-win*
94+
draft: true
95+
generate_release_notes: true

0 commit comments

Comments
 (0)