소스 검색

Update Github Action VM to Ubuntu 20.04 and pin GCC/Clang versions (#223)

Mike Chang 1 년 전
부모
커밋
053a4b8a4a
2개의 변경된 파일47개의 추가작업 그리고 11개의 파일을 삭제
  1. 33 9
      .github/workflows/build-container.yaml
  2. 14 2
      .github/workflows/build-package.yaml

+ 33 - 9
.github/workflows/build-container.yaml

@@ -23,26 +23,50 @@ jobs:
       packages: write
       packages: write
     steps:
     steps:
       - name: Run build command (aarch64)
       - name: Run build command (aarch64)
-        uses: uraimo/run-on-arch-action@v2
+        uses: uraimo/run-on-arch-action@v2.5.1
         with:
         with:
           env: |
           env: |
-            GITHUB_WORKFLOW: ${{ github.workflow }}
-            SCCACHE_VER: 0.5.4
+            GITHUB_WORKFLOW: ${{ github.workflow }} # Sets the docker image to the name of the workflow
           arch: aarch64
           arch: aarch64
-          distro: ubuntu_latest
+          distro: ubuntu20.04
           githubToken: ${{ github.token }}
           githubToken: ${{ github.token }}
           shell: /bin/bash
           shell: /bin/bash
           install: |
           install: |
+            ## Set variables. "env" not supported in install phase
+            export CLANG_VER=12
+            export GCC_VER=9
+            export SCCACHE_VER=0.5.4
+            export CMAKE_VER=3.27.6
+            ## Install build dependancies from apt
             apt-get update
             apt-get update
-            apt-get install -y build-essential cmake curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \
-              ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common
+            apt-get install -y build-essential curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \
+              ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common wget
             python3 -m pip install boto3 certifi
             python3 -m pip install boto3 certifi
-            curl -L 'https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-aarch64-unknown-linux-musl.tar.gz' \
-              | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache'
-            chmod +x '/usr/local/bin/sccache'
+            # Install Clang/GCC at specific version
+            apt-get install -y clang-${CLANG_VER} gcc-${GCC_VER} g++-${GCC_VER}
+            update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VER} 10
+            update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VER} 10
+            update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VER} 10
+            update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VER} 10
+            ## Install sccache
+            wget -qO- "https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VER}/sccache-v${SCCACHE_VER}-aarch64-unknown-linux-musl.tar.gz" \
+              | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache' \
+              && chmod +x '/usr/local/bin/sccache'
+            ## Install cmake  
+            wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-aarch64.sh" \
+              -O /tmp/cmake-install.sh \
+              && chmod u+x /tmp/cmake-install.sh \
+              && mkdir /opt/cmake-${CMAKE_VER} \
+              && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
+              && rm /tmp/cmake-install.sh \
+              && ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
+            rm -rf /var/lib/apt/lists/*
           run: |
           run: |
             lsb_release -a
             lsb_release -a
             uname -a
             uname -a
+            gcc --version
+            g++ --version
+            clang --version
             sccache --version
             sccache --version
             cmake --version
             cmake --version
             git --version
             git --version

+ 14 - 2
.github/workflows/build-package.yaml

@@ -34,7 +34,7 @@ jobs:
             PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p')
             PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p')
             case $PLATFORM in
             case $PLATFORM in
             linux*)
             linux*)
-              OS_RUNNER="ubuntu-latest"
+              OS_RUNNER="ubuntu-20.04"
               ;;
               ;;
             windows)
             windows)
               OS_RUNNER="windows-2019"
               OS_RUNNER="windows-2019"
@@ -145,6 +145,18 @@ jobs:
     - name: Update msbuild path
     - name: Update msbuild path
       if: runner.os == 'Windows'
       if: runner.os == 'Windows'
       uses: ilammy/[email protected]
       uses: ilammy/[email protected]
+    
+    - name: Install clang/gcc
+      if: runner.os == 'Linux'
+      env:
+        CLANG_VER: 12
+        GCC_VER: 9
+      run: |
+        sudo apt-get install -y clang-${{ env.CLANG_VER }} gcc-${{ env.GCC_VER }} g++-${{ env.GCC_VER }}
+        sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 10
+        sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.CLANG_VER }} 10
+        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 10
+        sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_VER }} 10
 
 
     - name: Use sccache
     - name: Use sccache
       uses: hendrikmuhs/[email protected]
       uses: hendrikmuhs/[email protected]
@@ -170,7 +182,7 @@ jobs:
       with:
       with:
         arch: none
         arch: none
         distro: none
         distro: none
-        base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu-latest:latest # built from build-container.yaml
+        base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu20-04:latest # built from build-container.yaml
         setup: |
         setup: |
           grep -q ${{ matrix.package }} ${PWD}/3p-package-source/package_build_list_host_linux.json || rm ${PWD}/3p-package-source/package_build_list_host_linux.json
           grep -q ${{ matrix.package }} ${PWD}/3p-package-source/package_build_list_host_linux.json || rm ${PWD}/3p-package-source/package_build_list_host_linux.json
         dockerRunArgs: |
         dockerRunArgs: |