Setup CI action to automate testing #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-test-thirdparty | ||
on: [push, pull_request] | ||
jobs: | ||
host-x86-build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
compiler: [gcc, clang] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install prerequisite | ||
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 }} | ||
run: | | ||
make clean | ||
make slimcc | ||
shell: bash | ||
- name: Test stage 1 | ||
run: | | ||
make test || exit 1 | ||
shell: bash | ||
- name: Build stage 2 artifact | ||
run: | | ||
make stage2/slimcc | ||
shell: bash | ||
- name: Test stage 2 | ||
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 }} | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64 | ||
context: . | ||
file: scripts/debian_asan.Dockerfile | ||
tags: debian_asan | ||
outputs: type=docker,dest=/tmp/debian_asan.tar | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: debian_asan | ||
path: /tmp/debian_asan.tar | ||
thirdparty-tests: | ||
runs-on: ubuntu-latest | ||
needs: [docker, host-x86-build] | ||
strategy: | ||
matrix: | ||
include: | ||
- thirdparty: test_cello | ||
- thirdparty: test_curl | ||
- thirdparty: test_doom | ||
- thirdparty: test_git | ||
- thirdparty: test_libpng | ||
- thirdparty: test_libuev | ||
- thirdparty: test_lua | ||
- thirdparty: test_metalang99 | ||
- thirdparty: test_oniguruma_jq | ||
- thirdparty: test_openssh | ||
- thirdparty: test_openssl | ||
- thirdparty: test_perl | ||
- thirdparty: test_php | ||
- thirdparty: test_postgres | ||
- thirdparty: test_python | ||
- thirdparty: test_qbe_hare | ||
- thirdparty: test_sqlite | ||
- thirdparty: test_tinycc | ||
- thirdparty: test_toxcore | ||
- thirdparty: test_toybox | ||
- thirdparty: test_vim | ||
- thirdparty: test_zlib | ||
- thirdparty: test_zstd | ||
- thirdparty: build_gcc | ||
- thirdparty: build_musl | ||
- thirdparty: build_nano | ||
- thirdparty: build_sdl | ||
matrix: | ||
compiler: [gcc, clang] | ||
steps: | ||
- name: Download debian asan artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: debian_asan | ||
path: /tmp | ||
- name: Download pre-built slimcc | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: slimcc-${{ matrix.compiler }} | ||
- run: | | ||
chmod +x slimcc-${{ matrix.compiler }} | ||
- name: Load image | ||
run: docker load --input /tmp/debian_asan.tar | ||
- name: Run test | ||
env: | ||
CC: slimcc-${{ matrix.compiler }} | ||
run: > | ||
sudo docker run debian_asan | ||
su non-root -c | ||
'bash "$0" "$1"' linux_thirdparty.bash ${{ matrix.thirdparty }} |