Fix #1298: Clustering fisher test crash #204
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: Snapshot test | |
on: | |
pull_request: | |
workflow_dispatch: | |
env: | |
DOCKER_TAG: bigomics/omicsplayground:latest | |
jobs: | |
unittest: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Shinytest docker | |
id: test-snapshot | |
run: | | |
docker build --build-arg GITHUB_SHA=${{ github.sha }} --build-arg HEAD_REF=${{ github.head_ref }} -t ${{ env.DOCKER_TAG }} -f ./.github/workflows/snapshot-test-resources/Dockerfile . | |
docker run --name run_tests bigomics/omicsplayground:latest | |
docker cp run_tests:omicsplayground/tests . | |
- | |
name: Upload snapshots as artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: testthat-snapshots | |
path: ./tests/* | |
if-no-files-found: ignore | |
- | |
name: Configure Git | |
if: always() | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
# - | |
# name: Setup upterm session | |
# uses: lhotari/action-upterm@v1 | |
# with: | |
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow | |
# limit-access-to-actor: true | |
# ## limits ssh access and adds the ssh public keys of the listed GitHub users | |
# limit-access-to-users: ESCRI11 | |
# wait-timeout-minutes: 120 | |
- | |
name: Commit and push snapshots | |
if: always() | |
run: | | |
cd ${{ github.workspace }} | |
if [[ `git status --porcelain` ]]; then | |
git checkout -b "${GITHUB_HEAD_REF}" | |
git add ./tests/* | |
git fetch origin "${GITHUB_HEAD_REF}" | |
git commit -m "Snapshot test failed: use snapshot_review('snapshot/') (GHA)" | |
git push --force-with-lease origin "${GITHUB_HEAD_REF}" | |
echo "snapshots pushed to repo" | |
fi | |
- | |
name: Fail GHA if snapshot test failed | |
if: always() | |
run: | | |
if [[ "${{ steps.test-snapshot.outputs.test_result }}" == "FALSE" ]]; then | |
exit 1 | |
fi |