From 3dcb97f38ca6816df4a0e2313f642de8254c530f Mon Sep 17 00:00:00 2001 From: Kyle Lin Date: Mon, 25 Nov 2024 23:01:23 +0800 Subject: [PATCH] Adopt cache-apt-pkgs, add curl 8.9.1 build & unit-test to workflow --- .github/workflows/main.yml | 49 ++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c28664..7b76550 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Github Actions on: [push, pull_request] jobs: - host-x86: + host-x86-build: runs-on: ubuntu-latest strategy: matrix: @@ -12,10 +12,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install prerequisite - run: | - sudo apt-get update -q -y - sudo apt-get install -q -y file - sudo apt-get install -q -y build-essential + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: file build-essential clang + version: 1.0 - name: Build stage 1 artifact env: CC: ${{ matrix.compiler }} @@ -35,3 +35,42 @@ jobs: run: | make test-stage2 || exit 1 shell: bash + - run: mv slimcc slimcc-${{ matrix.compiler }} + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: slimcc-${{ matrix.compiler }} + path: slimcc-${{ matrix.compiler }} + + test-building-real-world-projects: + needs: host-x86-build + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [gcc, clang] + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: slimcc-${{ matrix.compiler }} + - run: | + chmod +x slimcc-${{ matrix.compiler }} + - uses: lukka/get-cmake@latest + with: + useLocalCache: true + - name: Install prerequisite + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: file build-essential clang libssh2-1 + version: 1.0 + - name: Test Building curl 8.9.1 + run: | + git clone --depth 1 https://github.com/curl/curl --branch curl-8_9_1 + mkdir curl/cmakebuild + cd curl/cmakebuild + cmake ../ -DCMAKE_C_COMPILER=${GITHUB_WORKSPACE}/slimcc-${{ matrix.compiler }} -DCMAKE_C_FLAGS=-fPIC + make -j + make test-quiet -j + shell: bash