Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
cancel redundant GH Actions workflows (#5226)
Browse files Browse the repository at this point in the history
* cancel redundant GH Actions workflows

* trigger CI

* fix job conditions

* run docker jobs on any self-hosted
  • Loading branch information
epwalsh authored May 26, 2021
1 parent 2d8f390 commit d662977
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
Expand Down Expand Up @@ -81,22 +85,22 @@ jobs:
pip freeze
- name: Format
if: always()
if: '! cancelled()'
run: |
make format
- name: Lint
if: always()
if: '! cancelled()'
run: |
make lint
- name: Type check
if: always()
if: '! cancelled()'
run: |
make typecheck
- name: Run tests
if: always()
if: '! cancelled()'
run: |
make test-with-cov
Expand Down Expand Up @@ -270,7 +274,8 @@ jobs:
docker:
name: Docker (CUDA ${{ matrix.cuda }})
if: github.repository == 'allenai/allennlp'
runs-on: [self-hosted, GPU]
# Run on self-hosted to utilize layer caching.
runs-on: [self-hosted]
strategy:
matrix:
cuda: ['10.1', '10.2', '11.1']
Expand Down Expand Up @@ -310,7 +315,7 @@ jobs:
- name: Test image
run: |
make docker-run DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME ARGS='test-install'
make docker-run DOCKER_GPUS='' DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME ARGS='test-install'
- name: Authenticate to Docker Hub
if: github.event_name == 'release' || github.event_name == 'push'
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ docker-image :
--build-arg TORCH=$(DOCKER_TORCH_VERSION) \
-t $(DOCKER_IMAGE_NAME) .

DOCKER_GPUS = --gpus all

.PHONY : docker-run
docker-run :
$(DOCKER_RUN_CMD) --gpus all $(DOCKER_IMAGE_NAME) $(ARGS)
$(DOCKER_RUN_CMD) $(DOCKER_GPUS) $(DOCKER_IMAGE_NAME) $(ARGS)

.PHONY : docker-test-image
docker-test-image :
Expand All @@ -161,4 +163,4 @@ docker-test-image :

.PHONY : docker-test-run
docker-test-run :
$(DOCKER_RUN_CMD) --gpus all $(DOCKER_TEST_IMAGE_NAME) $(ARGS)
$(DOCKER_RUN_CMD) $(DOCKER_GPUS) $(DOCKER_TEST_IMAGE_NAME) $(ARGS)

0 comments on commit d662977

Please sign in to comment.