From 53e9cb71c124c043f89c0ad4c705ca34e27d82cb Mon Sep 17 00:00:00 2001 From: jorgensd Date: Mon, 13 May 2024 21:48:28 +0200 Subject: [PATCH] Reduce number of CI workflow files by supporting input tags for docker image --- .github/workflows/deploy.yml | 6 ++++- .github/workflows/docs.yml | 17 ++++++++++++- .github/workflows/test_stable.yml | 40 ------------------------------- .github/workflows/tests.yml | 24 +++++++++++++++---- 4 files changed, 40 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/test_stable.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b1ddc61..6e7b6e9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,9 +24,13 @@ concurrency: jobs: build-docs: uses: ./.github/workflows/docs.yml + with: + tag: "stable" run-tests: - uses: ./.github/workflows/test_stable.yml + uses: ./.github/workflows/tests.yml + with: + tag: "stable" deploy: runs-on: ubuntu-22.04 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4a96610..ac16cd6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,7 +6,19 @@ on: - main workflow_dispatch: + inputs: + tag: + description: 'Tag of DOLFINx docker image' + default: 'nightly' + required: true + type: string workflow_call: + inputs: + tag: + description: 'Tag of DOLFINx docker image' + default: 'nightly' + required: true + type: string env: DEB_PYTHON_INSTALL_LAYOUT: deb_system @@ -14,7 +26,10 @@ env: jobs: build: runs-on: ubuntu-22.04 - container: ghcr.io/fenics/dolfinx/dolfinx:stable + env: + DEFAULT_TAG: nightly + DEB_PYTHON_INSTALL_LAYOUT: deb_system + container: ghcr.io/fenics/dolfinx/dolfinx:${{ inputs.tag || github.env.DEFAULT_TAG }} steps: - name: Checkout diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml deleted file mode 100644 index ed9df88..0000000 --- a/.github/workflows/test_stable.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Test package against stable release - -on: - workflow_call: - workflow_dispatch: - pull_request: - branches: - - main - push: - branches: - - main - -env: - DEB_PYTHON_INSTALL_LAYOUT: deb_system - -jobs: - tests: - runs-on: ubuntu-22.04 - container: ghcr.io/fenics/dolfinx/dolfinx:stable - - steps: - - name: Checkout at last working position - uses: actions/checkout@v4 - # with: - # ref: v1.0.0 - # ${{ github.ref }} # once backward compatibility is broken this should be pinned to a release - - - name: Install oasisx - run: python3 -m pip install .[test,docs] - - - name: Run formatting checks - uses: ./.github/actions/linting - - - name: Run tests - run: python3 -m pytest - - - name: Run demos - run: | - python3 demo/taylor_green.py -N 8 -N 16 -N 32 -dt=0.005 - python3 demo/assembly_strategies.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d3a85d9..59e33e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,24 +1,38 @@ -name: Test package against nightly image - +name: Test OASISx against DOLFINx (docker) on: push: branches: - main workflow_call: + inputs: + tag: + description: 'Tag of DOLFINx docker image' + default: 'nightly' + required: true + type: string workflow_dispatch: + inputs: + tag: + description: 'Tag of DOLFINx docker image' + default: 'nightly' + required: true + type: string + pull_request: branches: - main schedule: - cron: "0 8 * * *" -env: - DEB_PYTHON_INSTALL_LAYOUT: deb_system jobs: tests: runs-on: ubuntu-22.04 - container: ghcr.io/fenics/dolfinx/dolfinx:nightly + env: + DEFAULT_TAG: nightly + DEB_PYTHON_INSTALL_LAYOUT: deb_system + + container: ghcr.io/fenics/dolfinx/dolfinx:${{ inputs.tag || github.env.DEFAULT_TAG }} steps: - uses: actions/checkout@v4