Skip to content

Commit

Permalink
github actions for cargo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixAja committed Apr 8, 2024
1 parent 2e1c117 commit 2329bc3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 31 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/index-generation-cargo-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Index Generation NCBI Compress cargo tests

on:
push:
paths:
- 'workflows/index-generation/ncbi-compress/*'

env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
DEBIAN_FRONTEND: noninteractive

jobs:
cargo-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: docker login ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build + push to ghcr.io
run: |
TAG=$(git describe --long --tags --always --dirty)
IMAGE_NAME=czid-index-generation-public
IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}"
CACHE_FROM=""; docker pull "$IMAGE_URI" && CACHE_FROM="--cache-from $IMAGE_URI"
./scripts/docker-build.sh "workflows/index-generation" --tag "${IMAGE_URI}:${TAG}" $CACHE_FROM \
|| ./scripts/docker-build.sh "workflows/index-generation" --tag "${IMAGE_URI}:${TAG}"
docker push "${IMAGE_URI}:${TAG}"
if [[ ${GITHUB_REF##*/} == "main" ]]; then
docker tag "${IMAGE_URI}:${TAG}" "${IMAGE_URI}:latest"
docker push "${IMAGE_URI}:latest"
fi
echo "IMAGE_URI=${IMAGE_URI}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: run cargo tests
run: |
make cargo-test-index-generation
31 changes: 0 additions & 31 deletions .github/workflows/wdl-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,34 +107,3 @@ jobs:
export DOCKER_IMAGE_ID="${IMAGE_URI}:${TAG}"
make test-${{ matrix.workflow_dir }}
cargo-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: docker login ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build + push to ghcr.io
run: |
TAG=$(git describe --long --tags --always --dirty)
IMAGE_NAME=czid-index-generation-public
IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}"
CACHE_FROM=""; docker pull "$IMAGE_URI" && CACHE_FROM="--cache-from $IMAGE_URI"
./scripts/docker-build.sh "workflows/index-generation" --tag "${IMAGE_URI}:${TAG}" $CACHE_FROM \
|| ./scripts/docker-build.sh "workflows/index-generation" --tag "${IMAGE_URI}:${TAG}"
docker push "${IMAGE_URI}:${TAG}"
if [[ ${GITHUB_REF##*/} == "main" ]]; then
docker tag "${IMAGE_URI}:${TAG}" "${IMAGE_URI}:latest"
docker push "${IMAGE_URI}:latest"
fi
echo "IMAGE_URI=${IMAGE_URI}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: run cargo tests
run: |
make cargo-test-index-generation

0 comments on commit 2329bc3

Please sign in to comment.