From f2633d9067df71dc82d05ef83b4a2b4059aec1ff Mon Sep 17 00:00:00 2001 From: Brad Aagaard Date: Tue, 29 Oct 2024 20:32:27 -0600 Subject: [PATCH] Create CI pipeline using GitHub Actions. --- .github/workflows/ci-main.yml | 17 +++++++++++++ .github/workflows/ci-stage-1.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/ci-stage-2.yml | 34 ++++++++++++++++++++++++++ docker/pylith-docenv | 2 +- 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-main.yml create mode 100644 .github/workflows/ci-stage-1.yml create mode 100644 .github/workflows/ci-stage-2.yml diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml new file mode 100644 index 0000000000..96a78d522e --- /dev/null +++ b/.github/workflows/ci-main.yml @@ -0,0 +1,17 @@ +name: run-ci + +concurrency: + group: ${{ github.actor }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + +jobs: + stage-1: + uses: ./.github/workflows/ci-stage-1.yml + stage-2: + uses: ./.github/workflows/ci-stage-2.yml + needs: [stage-1] diff --git a/.github/workflows/ci-stage-1.yml b/.github/workflows/ci-stage-1.yml new file mode 100644 index 0000000000..65590663c9 --- /dev/null +++ b/.github/workflows/ci-stage-1.yml @@ -0,0 +1,42 @@ +name: stage-1 + +on: + - workflow_call + +env: + IMAGE_REGISTRY: "ghcr.io/geodynamics/pylith_installer" + +jobs: + + # CI tests + tests: + strategy: + matrix: + os: + - debian-stable + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build Docker image + run: docker build -t pylith-testenv --build-arg BASE_IMAGE=$IMAGE_REGISTRY/testenv-${{ matrix.os }} --target build -f docker/pylith-testenv . + + - name: Run tests + run: docker run pylith-testenv ci-config/run_tests.sh + + # Build documentation + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build Docker image + run: docker build -t pylith-docenv --build-arg BASE_IMAGE=$IMAGE_REGISTRY/testenv-ubuntu-22.04 -f docker/pylith-docenv . + + diff --git a/.github/workflows/ci-stage-2.yml b/.github/workflows/ci-stage-2.yml new file mode 100644 index 0000000000..64621e6aa3 --- /dev/null +++ b/.github/workflows/ci-stage-2.yml @@ -0,0 +1,34 @@ +name: stage-2 + +on: + - workflow_call + +env: + IMAGE_REGISTRY: "ghcr.io/geodynamics/pylith_installer" + +jobs: + + # CI tests + tests: + strategy: + matrix: + os: + - debian-testing + - ubuntu-20.04 + - ubuntu-22.04 + - fedora-39 + - rockylinux-8 + - rockylinux-9 + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build Docker image + run: docker build -t pylith-testenv --build-arg BASE_IMAGE=$IMAGE_REGISTRY/testenv-${{ matrix.os }} --target build -f docker/pylith-testenv . + + - name: Run tests + run: docker run pylith-testenv ci-config/run_tests.sh diff --git a/docker/pylith-docenv b/docker/pylith-docenv index b13c700edd..87eea7fa9e 100644 --- a/docker/pylith-docenv +++ b/docker/pylith-docenv @@ -12,7 +12,7 @@ ENV src_dir=${TOPSRC_DIR}/pylith COPY --chown=pylith-tester:pylith-tester . ${src_dir} WORKDIR ${src_dir}/docs -RUN python3 -m pip install sphinx myst-parser pydata-sphinx-theme sphinxcontrib.bibtex +RUN python3 -m pip install -r requirements.txt RUN ./build.sh CMD /bin/bash