-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dockerfile Makefile and publish ci (#3)
- Loading branch information
Showing
6 changed files
with
106 additions
and
68 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,69 @@ | ||
name: Build and publish | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')" | ||
strategy: | ||
matrix: | ||
target: [ x86_64-unknown-linux-gnu ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set latest release version | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
id: set_version | ||
uses: actions/github-script@v6 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const { data: releases } = await github.rest.repos.listReleases({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
const { data: tags } = await github.rest.repos.listTags({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
if (releases.length === 0) { return "v0.0.1"; } | ||
function increase_v(version) { | ||
const parts = version.split("."); | ||
const last = parseInt(parts[2]) + 1; | ||
const next_version = `${parts[0]}.${parts[1]}.${last.toString()}`; | ||
return next_version; | ||
} | ||
const latest_release_tag = releases[0].tag_name; | ||
const tag = tags.find(tag => tag.commit.sha === context.sha); | ||
return tag ? tag.name : increase_v(latest_release_tag) | ||
- name: install deps | ||
run: | | ||
sudo apt update | ||
sudo apt-get install -y --no-install-recommends \ | ||
libcurl4-openssl-dev libelf-dev clang llvm cmake zlib1g-dev | ||
wget https://github.com/eunomia-bpf/eunomia-bpf/releases/latest/download/ecc && chmod +x ./ecc | ||
- name: build package | ||
run: ./ecc template.bpf.c template.h | ||
|
||
- name: Publish | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: package.json | ||
prerelease: false | ||
tag_name: ${{ steps.set_version.outputs.result }} | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.vscode | ||
package.json | ||
*.o | ||
*.skel.json |
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 @@ | ||
build: | ||
ecc template.bpf.c template.h | ||
|
||
clean: | ||
rm *.json | ||
rm *.o |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ghcr.io/eunomia-bpf/ecc-x86_64:latest | ||
|
||
COPY . /root/template | ||
WORKDIR /root/template | ||
|
||
RUN wget -q -O /root/.eunomia/bin/ecli https://github.com/eunomia-bpf/eunomia-bpf/releases/latest/download/ecli | ||
|
||
RUN chmod +x /root/.eunomia/bin/ecli | ||
|
||
ENV PATH="/root/.eunomia/bin:${PATH}" | ||
|
||
ENTRYPOINT ["/bin/bash"] |