Skip to content

Commit

Permalink
Fix cmake on self-runner (#460)
Browse files Browse the repository at this point in the history
Fix cmake on self-runner (#460)
  • Loading branch information
etaques authored Sep 20, 2022
1 parent c82e0f9 commit 1244d92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL author="Everton Haise Taques <[email protected]>"
LABEL maintainer="NS1 Labs"
LABEL version="1.0.0"

ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3-pip python3-setuptools ca-certificates libasan6 zip curl"
ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3-pip python3-setuptools ca-certificates libasan6 zip curl python"

COPY ./entrypoint.sh /entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion .github/hosted-runner/amd64/user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apt-get update -y
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python xvfb \
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf g++-10-multilib-arm-linux-gnueabihf \
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd -y
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake -y

#set permission to use docker
usermod -aG docker ubuntu
Expand Down
2 changes: 1 addition & 1 deletion .github/hosted-runner/arm64/user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apt-get update -y
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python2 xvfb \
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf \
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf cmake \
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base python3-venv tcpreplay docker.io containerd -y

#set permission to use docker
Expand Down
113 changes: 17 additions & 96 deletions .github/workflows/build-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix

runs-on: ubuntu-latest
outputs:
version_number: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -103,6 +105,12 @@ jobs:
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Get VERSION
id: build
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
echo "::set-output name=version::$(cat ${{github.workspace}}/build/VERSION)"
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
Expand All @@ -125,9 +133,6 @@ jobs:
package-amd64:
needs: [ unit-tests-linux ]
runs-on: ubuntu-latest
outputs:
version_number: ${{ steps.build.outputs.version }}
branch_name: ${{ steps.branch.outputs.name }}
# if this is a push into one of our main branches (rather than just a pull request), we will also package
if: github.event_name != 'pull_request'
steps:
Expand All @@ -151,38 +156,6 @@ jobs:
- name: Debug artifacts
run: ls -lha .

- name: Get branch name
id: branch
shell: bash
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
echo "::set-output name=name::$(echo ${GITHUB_REF#refs/heads/} | tr / -)"
- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Get Conan
uses: turtlebrowser/[email protected]

- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Get VERSION
id: build
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
echo "::set-output name=version::$(cat ${{github.workspace}}/build/VERSION)"
- name: Debug version
run: |
echo ${{ env.VERSION }}
echo ${{ steps.build.outputs.version }}
- name: Generate ref tag (develop)
run: |
echo "REF_TAG=latest-develop" >> $GITHUB_ENV
Expand Down Expand Up @@ -233,7 +206,7 @@ jobs:
file: ./docker/Dockerfile.crashhandler
platforms: linux/amd64
push: true
tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }} , ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} , ${{ env.IMAGE_NAME2 }}:amd64
tags: ${{ env.IMAGE_NAME }}:${{ needs.unit-tests-linux.outputs.version_number }} , ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} , ${{ env.IMAGE_NAME2 }}:amd64

build-app-image-x64:
needs: [ package-amd64 ]
Expand Down Expand Up @@ -661,7 +634,7 @@ jobs:
retention-days: 1

package-arm64:
needs: [ spinup-arm64-runner ]
needs: [ unit-tests-linux, spinup-arm64-runner ]
runs-on: [self-hosted, linux, ARM64]
if: github.event_name != 'pull_request'
steps:
Expand All @@ -682,32 +655,9 @@ jobs:
with:
context: "."
file: "./Dockerfile"

- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Get Conan
uses: turtlebrowser/[email protected]

- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Get VERSION
id: build
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}

- name: Debug artifacts
run: ls -lha .

- name: Generate ref tag (develop)
if: ${{ env.BRANCH_NAME == 'develop' }}
Expand All @@ -716,9 +666,6 @@ jobs:
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "DRAFT=true" >> $GITHUB_ENV
- name: Debug ref tag
run: echo ${{ env.REF_TAG }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand Down Expand Up @@ -829,33 +776,10 @@ jobs:
terraform destroy -auto-approve
pushing-manifests:
needs: [ remove-github-runner-arm64 ]
needs: [ unit-tests-linux, remove-github-runner-arm64 ]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Get Conan
uses: turtlebrowser/[email protected]

- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Get VERSION
id: build
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand All @@ -868,9 +792,6 @@ jobs:
docker manifest create ghcr.io/ns1labs/pktvisor:latest-develop \
ghcr.io/ns1labs/pktvisor:amd64 \
ghcr.io/ns1labs/pktvisor:arm64
docker manifest create ghcr.io/ns1labs/pktvisor:${{ env.VERSION }} \
ghcr.io/ns1labs/pktvisor:amd64 \
ghcr.io/ns1labs/pktvisor:arm64
- name: Push manifest to ghcr.io
run: |
Expand All @@ -897,7 +818,7 @@ jobs:
docker://docker.io/ns1labs/pktvisor:latest-develop
sudo skopeo copy \
--all \
docker://ghcr.io/ns1labs/pktvisor:${{ env.VERSION }} \
docker://docker.io/ns1labs/pktvisor:${{ env.VERSION }}
docker://ghcr.io/ns1labs/pktvisor:latest-develop \
docker://docker.io/ns1labs/pktvisor:${{ needs.unit-tests-linux.outputs.version_number }}

0 comments on commit 1244d92

Please sign in to comment.