Skip to content

Commit

Permalink
separate master and beta docker tests into separate workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispyles committed Sep 2, 2024
1 parent 082b1d0 commit d897d6a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 22 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/run-docker-tests-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Workflow for running the test suite including long-running tests using Docker

name: Run Docker tests (beta)

on:
workflow_run:
workflows: [Run Docker tests]
types:
- requested
workflow_dispatch:

jobs:
build:
name: Test suite
runs-on: ubuntu-latest

env:
TAR: /bin/tar
DOCKER_BUILDKIT: 1
DOCKER_CLI_EXPERIMENTAL: enabled

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: Fetch origin
run: |
git fetch origin
- name: Check that branch exists
id: check-branch
run: |
if git show-ref --quiet refs/remotes/origin/beta; then
echo "run=true" > $GITHUB_OUTPUT
else
echo "run=false" > $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
ref: beta

- uses: docker/setup-buildx-action@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
install: true

- uses: r-lib/actions/setup-tinytex@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}

- uses: r-lib/actions/setup-pandoc@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}

- uses: liskin/gh-pipx@v1
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
packages: >-
poetry
- uses: mamba-org/setup-micromamba@v1
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
environment-file: environment.yml
init-shell: >-
bash
cache-environment: true
cache-environment-key: requirements-${{ hashFiles('pyproject.toml') }}

- name: Install dependencies
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba activate otter-grader
poetry install --with test --all-extras
- name: Install ottr
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba run -n otter-grader Rscript -e 'install.packages("ottr", dependencies=TRUE, repos="https://cran.r-project.org/")'
- name: Maximize build space
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
df -h
- name: Run tests
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba activate otter-grader
make testcov PYTESTOPTS="-vv" && coverage lcov -i
- name: Coveralls
if: ${{ steps.check-branch.outputs.run == 'true' }}
uses: coverallsapp/github-action@v2
22 changes: 0 additions & 22 deletions .github/workflows/run-docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
name: Test suite
runs-on: ubuntu-latest

strategy:
matrix:
branch: [master, beta]

env:
TAR: /bin/tar
DOCKER_BUILDKIT: 1
Expand All @@ -33,33 +29,19 @@ jobs:
run: |
git fetch origin
- name: Check that branch exists
id: check-branch
run: |
if git show-ref --quiet refs/remotes/origin/${{ matrix.branch }}; then
echo "run=true" > $GITHUB_OUTPUT
else
echo "run=false" > $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
ref: ${{ matrix.branch }}

- uses: docker/setup-buildx-action@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
install: true

- uses: r-lib/actions/setup-tinytex@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}

- uses: r-lib/actions/setup-pandoc@v2
if: ${{ steps.check-branch.outputs.run == 'true' }}

- uses: mamba-org/setup-micromamba@v1
if: ${{ steps.check-branch.outputs.run == 'true' }}
with:
environment-file: environment.yml
init-shell: >-
Expand All @@ -68,24 +50,20 @@ jobs:
cache-environment-key: requirements-${{ hashFiles('requirements*.txt') }}

- name: Install ottr
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba run -n otter-grader Rscript -e 'install.packages("ottr", dependencies=TRUE, repos="https://cran.r-project.org/")'
- name: Maximize build space
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
df -h
- name: Run tests
if: ${{ steps.check-branch.outputs.run == 'true' }}
run: |
micromamba activate otter-grader
make testcov PYTESTOPTS="-vv" && coverage lcov -i
- name: Coveralls
if: ${{ steps.check-branch.outputs.run == 'true' }}
uses: coverallsapp/github-action@v2

0 comments on commit d897d6a

Please sign in to comment.