diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yaml | 111 | ||||
-rw-r--r-- | .github/workflows/monkey-test.yaml | 69 | ||||
-rw-r--r-- | .github/workflows/static-analysis.yaml | 65 |
3 files changed, 245 insertions, 0 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..eb92cdda1 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,111 @@ +name: "Linux Build" + +on: [push] + +jobs: + linux: + name: '${{ matrix.os }}: ${{ matrix.compiler.vendor }}' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + - ubuntu-20.04 + compiler: + # The NetSurf build system can't find LLVM AR (it looks for it + # in /usr/lib instead of /usr/bin: + # `make: /usr/lib/llvm-ar: No such file or directory`). + # So we need to make it explicit for llvm. + - { vendor: gnu, CC: gcc } + - { vendor: llvm, CC: clang, AR: llvm-ar } + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: apt-get install packages + run: sudo apt-get update -qq && + sudo apt-get install --no-install-recommends -y + bison + build-essential + ccache + check + clang + flex + git + gperf + libcurl4-openssl-dev + libgtk-3-dev + libhtml-parser-perl + libjpeg-dev + libpng-dev + librsvg2-dev + llvm + pkg-config + wbritish # Needed for `/usr/share/dict/words`, used by test + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.vendor }} + max-size: 128M + + - name: Build and install project libs + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + ns-clone -d -s + ns-make-tools install + ns-make-libs install + + - name: Disable -Werror + # We can remove this step if we ever move to GitHub properly. + run: | + find . -type f -name Makefile | xargs sed -i 's/-Werror//' + + - name: Unit Tests + # Fails when built with clang: + # test/corestrings.c:58:F:corestrings:corestrings_test:486: + # Assertion 'ires == NSERROR_NOMEM' failed: ires == 0, NSERROR_NOMEM == 2 + # Looks like `malloc_limit()` not working. + if: ${{ matrix.compiler.vendor != 'llvm' }} + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make test + + - name: Build NetSurf GTK + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make -j"$(nproc)" TARGET=gtk + + - name: Build NetSurf Monkey + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make -j"$(nproc)" TARGET=monkey + + - name: Build NetSurf Framebuffer + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make -j"$(nproc)" TARGET=framebuffer diff --git a/.github/workflows/monkey-test.yaml b/.github/workflows/monkey-test.yaml new file mode 100644 index 000000000..e95c9796f --- /dev/null +++ b/.github/workflows/monkey-test.yaml @@ -0,0 +1,69 @@ +name: "Monkey Test" + +on: [pull_request] + +jobs: + test: + name: '${{ matrix.test }}' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + test: + - short-internet + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: apt-get install packages + run: sudo apt-get update -qq && + sudo apt-get install --no-install-recommends -y + bison + build-essential + ccache + check + clang + flex + git + gperf + libcurl4-openssl-dev + libgtk-3-dev + libhtml-parser-perl + libjpeg-dev + libpng-dev + librsvg2-dev + llvm + pkg-config + wbritish # Needed for `/usr/share/dict/words`, used by test + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }} + max-size: 128M + + - name: Build and install project libs + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + ns-clone -d -s + ns-make-tools install + ns-make-libs install + + - name: Disable -Werror + # We can remove this step if we ever move to GitHub properly. + run: | + find . -type f -name Makefile | xargs sed -i 's/-Werror//' + + - name: Build NetSurf Monkey + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make -j"$(nproc)" TARGET=monkey + + - name: Run Monkey Test + run: | + LC_ALL=C.UTF-8 test/monkey-see-monkey-do -v -d ${{ matrix.test }} diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml new file mode 100644 index 000000000..8604761fe --- /dev/null +++ b/.github/workflows/static-analysis.yaml @@ -0,0 +1,65 @@ +name: "Static Analysis" + +on: [push] + +jobs: + codeql: + name: codeql + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + language: ['cpp'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: apt-get install packages + run: sudo apt-get update -qq && + sudo apt-get install --no-install-recommends -y + bison + build-essential + ccache + flex + git + gperf + libcurl4-openssl-dev + libgtk-3-dev + libhtml-parser-perl + libjpeg-dev + libpng-dev + librsvg2-dev + pkg-config + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }} + max-size: 128M + + - name: Build and install project libs + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + ns-clone -d -s + ns-make-tools install + ns-make-libs install + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Build NetSurf + run: | + export TARGET_WORKSPACE="$(pwd)/projects" + source docs/env.sh + make -j"$(nproc)" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 |