diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 000000000..8416475f4 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,19 @@ +FROM centos:7 +COPY .github/workflows/install_centos_dependencies_build.sh . +RUN chmod +x install_centos_dependencies_build.sh +RUN ls -la && bash install_centos_dependencies_build.sh +RUN yum clean all +ENV CC=/opt/rh/devtoolset-11/root/usr/bin/gcc +ENV CXX=/opt/rh/devtoolset-11/root/usr/bin/g++ +ENV QMAKE_CC='/opt/rh/devtoolset-11/root/usr/bin/gcc' +ENV QMAKE_CXX='/opt/rh/devtoolset-11/root/usr/bin/g++' +ENV PATH="/usr/local/Qt6.2.4/bin:/usr/lib/ccache:$PATH" +ENV PREFIX=/tmp/foedag-install +ENV ADDITIONAL_CMAKE_OPTIONS='-DMY_CXX_WARNING_FLAGS="-W -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Werror -UNDEBUG"' +ENV RULE_MESSAGES=off +ENV LC_ALL=en_US.utf-8 +ENV LANG=en_US.utf-8 +ENV PRODUCTION_DEVICES="" +RUN useradd -m -d /home/runner -u 1001 -s /bin/bash -p $(openssl passwd -1 "$pass") runner +USER runner +ENTRYPOINT ["/bin/bash"] diff --git a/.github/workflows/build_centos_image.yml.yml b/.github/workflows/build_centos_image.yml.yml new file mode 100644 index 000000000..48e1fcc89 --- /dev/null +++ b/.github/workflows/build_centos_image.yml.yml @@ -0,0 +1,46 @@ +name: Create and publish a CentOS 7 Docker image +on: + push: + paths: + - .github/workflows/install_centos_dependencies_build.sh + - .github/workflows/Dockerfile + - .github/workflows/build_centos_image.yml +env: + REGISTRY: ghcr.io + IMAGE_NAME: os-fpga/foedag + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.0.0 + with: + context: . + file: .github/workflows/Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:centos7latest + labels: ${{ steps.meta.outputs.labels }} + + \ No newline at end of file diff --git a/.github/workflows/install_centos_dependencies_build.sh b/.github/workflows/install_centos_dependencies_build.sh index 8dcc004c7..11b3783a9 100644 --- a/.github/workflows/install_centos_dependencies_build.sh +++ b/.github/workflows/install_centos_dependencies_build.sh @@ -1,6 +1,9 @@ # Install required dependencies for CentOS systems yum update -y yum group install -y "Development Tools" +yum remove -y git* +yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm +yum install -y git wget yum install -y epel-release curl -C - -O https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz tar xzf cmake-3.24.4-linux-x86_64.tar.gz @@ -27,11 +30,12 @@ yum install -y gtk3-devel zip unzip yum install -y libusbx-devel libusb-devel yum install -y pkgconfig yum install -y perl-IPC-Cmd -yum install -y alsa-lib +yum install -y alsa-lib mesa-dri-drivers openssl openssl-devel sudo ln -s $PWD/cmake-3.24.4-linux-x86_64/bin/ctest /usr/bin/ctest -echo 'QMAKE_CC=/opt/rh/devtoolset-11/root/usr/bin/gcc' >> $GITHUB_ENV -echo 'QMAKE_CXX=/opt/rh/devtoolset-11/root/usr/bin/g++' >> $GITHUB_ENV -echo 'PATH=/usr/local/Qt-6.5.1/bin:/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV + +# downloads the Qt6 artifact from a specific URL +# saves it as 'buildqt6-centos7-gcc.tar.gz.' +wget https://github.com/RapidSilicon/post_build_artifacts/releases/download/v0.2/qt6.2.4_withopensslWebEngine.tar.gz -O buildqt6-centos7-gcc.tar.gz if [ -f buildqt6-centos7-gcc.tar.gz ] then diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85898016a..1930791c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -144,9 +144,7 @@ jobs: centos7-gcc: name: centos-${{ matrix.mode }} - runs-on: ubuntu-20.04 - container: - image: centos:7 + runs-on: ubuntu-latest defaults: run: shell: bash @@ -165,12 +163,16 @@ jobs: uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - - - name: update Git - run: | - yum remove -y git* - yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm - yum install -y git wget + + - name: Log in to the Container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: pull the CentOS image + run: docker pull ghcr.io/os-fpga/foedag:centos7latest - name: Checkout code uses: actions/checkout@v3 @@ -178,52 +180,48 @@ jobs: submodules: recursive fetch-depth: 0 -# downloads the Qt6 artifact from a specific URL -# saves it as 'buildqt6-centos7-gcc.tar.gz.' - - - name: Download Qt6 artifact - run: | - wget https://github.com/RapidSilicon/post_build_artifacts/releases/download/v0.2/qt6.2.4_withopensslWebEngine.tar.gz -O buildqt6-centos7-gcc.tar.gz - -# runs a script to install the required dependencies -# Qt6 using the CentOS-specific installation script - - - name: Install dependencies and build QT - run: | - bash .github/workflows/install_centos_dependencies_build.sh + - name: Use ccache + uses: hendrikmuhs/ccache-action@v1.2.3 + with: + key: linux-${{ matrix.mode }} - name: Show shell configuration - run: | - env - source /opt/rh/devtoolset-11/enable - which gcc - which g++ - - - name: Configure shell - run: | - source /opt/rh/devtoolset-11/enable - echo 'CC=/opt/rh/devtoolset-11/root/usr/bin/gcc' >> $GITHUB_ENV - echo 'CXX=/opt/rh/devtoolset-11/root/usr/bin/g++' >> $GITHUB_ENV - echo 'PATH=/usr/local/Qt6.2.4/bin:/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV - echo 'PREFIX=/tmp/foedag-install' >> $GITHUB_ENV - echo "$PREFIX" >> $GITHUB_PATH - echo "ADDITIONAL_CMAKE_OPTIONS='-DMY_CXX_WARNING_FLAGS="-W -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Werror -UNDEBUG"'" >> $GITHUB_ENV - echo 'RULE_MESSAGES=off' >> $GITHUB_ENV + uses: addnab/docker-run-action@v3 + with: + shell: bash + image: ghcr.io/os-fpga/foedag:centos7latest + run: | + env + source /opt/rh/devtoolset-11/enable + which gcc + which g++ - name: Test/batch if: matrix.mode == 'test/batch' - run: | - export LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/dbuild/bin/gtkwave/lib:${GITHUB_WORKSPACE}/third_party/openssl:$LD_LIBRARY_PATH - make MONACO_EDITOR=1 debug test/unittest-d - make MONACO_EDITOR=1 release test/batch + uses: addnab/docker-run-action@v3 + with: + shell: bash + image: ghcr.io/os-fpga/foedag:centos7latest + options: -v ${{ github.workspace }}:/home/runner + run: | + cd $HOME + export LD_LIBRARY_PATH=$HOME/dbuild/bin/gtkwave/lib:$HOME/third_party/openssl:$LD_LIBRARY_PATH + make debug test/unittest-d + make release test/batch - name: Test/gui if: matrix.mode == 'test/gui' - run: | - export LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/dbuild/bin/gtkwave/lib:${GITHUB_WORKSPACE}/third_party/openssl:$LD_LIBRARY_PATH - make MONACO_EDITOR=1 debug - make MONACO_EDITOR=1 test/gui - make MONACO_EDITOR=1 regression + uses: addnab/docker-run-action@v3 + with: + shell: bash + image: ghcr.io/os-fpga/foedag:centos7latest + options: -v ${{ github.workspace }}:/home/runner + run: | + cd $HOME + export LD_LIBRARY_PATH=$HOME/dbuild/bin/gtkwave/lib:$HOME/third_party/openssl:$LD_LIBRARY_PATH + make debug + make test/gui + make regression - name: show space after build & test if: always ()