-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish built binaries as image in OCI registry (#13)
- Loading branch information
1 parent
af8cd6d
commit fbae56d
Showing
11 changed files
with
165 additions
and
76 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,8 @@ | ||
name: Build | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build | ||
shell: bash | ||
run: cmake --build --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} |
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,14 @@ | ||
name: Install requirements | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install requirements | ||
shell: bash | ||
run: | | ||
sudo apt-get install -y libelf-dev | ||
sudo apt-get install -y clang | ||
pip install cmake==3.23.3 | ||
pip install conan==2.0 | ||
conan profile detect | ||
conan install . --build=missing -s build_type=${{ env.CAPITALISED_BUILD_TYPE }} |
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,30 @@ | ||
name: Set environment variables | ||
|
||
inputs: | ||
build-type: | ||
description: Release or Debug | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set environment variables | ||
shell: bash | ||
run: | | ||
buildType=${{ inputs.build-type }} | ||
printf "CAPITALISED_BUILD_TYPE=%s\n" "${buildType}" >> $GITHUB_ENV | ||
printf "LOWERCASE_BUILD_TYPE=%s\n" "${buildType,,}" >> $GITHUB_ENV | ||
newestTag="$(git describe --tags --abbrev=0)" | ||
artifactVersionWithTimestamp="${newestTag}"-"$(date +%Y%m%d_%H%M%S)" | ||
printf "GITHUB_OCI_REGISTRY_ARTIFACT_VERSION=%s\n" "${artifactVersionWithTimestamp}" >> $GITHUB_ENV | ||
printf "RELEASE_PATH=%s\n" "${{ github.workspace }}/build/Release" >> $GITHUB_ENV | ||
repositoryName="$(printf "%s" "${{ github.repository }}" | sed -e "s/^${{ github.repository_owner }}\///")" | ||
lowercaseRepositoryName="${repositoryName,,}" | ||
printf "LOWERCASE_REPOSITORY_NAME=%s\n" "${lowercaseRepositoryName}" >> $GITHUB_ENV | ||
githubOCIRegistryAddress=ghcr.io/${{ github.repository_owner }}/"${lowercaseRepositoryName}" | ||
printf "GITHUB_OCI_REGISTRY_ADDRESS=%s\n" "${githubOCIRegistryAddress}" >> $GITHUB_ENV |
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,8 @@ | ||
name: Test | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Test | ||
shell: bash | ||
run: ctest --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} |
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,10 @@ | ||
name: Update packages | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Update packages | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get upgrade -y |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build and test Debug | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
|
||
jobs: | ||
build-and-test-debug: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code of the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update packages | ||
uses: ./.github/actions/update-packages | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Debug | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Debug | ||
|
||
- name: Install requirements | ||
uses: ./.github/actions/install-requirements | ||
|
||
- name: Configure | ||
shell: bash | ||
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} -DBUILD_TESTS=ON | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Test | ||
uses: ./.github/actions/test |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build, test and publish Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-test-and-publish-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code of the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update packages | ||
uses: ./.github/actions/update-packages | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Release | ||
|
||
- name: Install requirements | ||
uses: ./.github/actions/install-requirements | ||
|
||
- name: Configure | ||
shell: bash | ||
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} -DBUILD_TESTS=ON | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Test | ||
uses: ./.github/actions/test | ||
|
||
- name: Move license to release directory | ||
run: mv ${{ github.workspace }}/LICENSE ${{ env.RELEASE_PATH }}/LICENSE | ||
|
||
- name: Zip release directory contents | ||
run: | | ||
cd ${{ env.RELEASE_PATH }} | ||
zip -r ${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }}.zip . | ||
- name: Login to GitHub OCI registry | ||
run: printf "%s" ${{ secrets.GITHUB_TOKEN }} | oras login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Publish zip to GitHub OCI registry | ||
run: | | ||
cd ${{ env.RELEASE_PATH }} | ||
oras push ${{ env.GITHUB_OCI_REGISTRY_ADDRESS }}:${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }} ${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }}.zip |
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 |
---|---|---|
|
@@ -14,3 +14,5 @@ | |
**/vmlinux.h | ||
/compile_commands.json | ||
/.cache | ||
|
||
!/.github/actions/build |