Added e2e test for spdk-csi #60
Workflow file for this run
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: Linux Unit tests and docker push | |
on: | |
pull_request: | |
push: | |
branches: ['master', 'dev'] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.21 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Test | |
run: | | |
make test | |
- name: Set docker image tag | |
id: get_info | |
run: | | |
if [[ "${{github.ref}}" == refs/pull/* ]]; then | |
tag=${GITHUB_REF/\/merge/} | |
echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV | |
else | |
echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV | |
fi | |
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build & Push | |
run: | | |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) | |
make image | |
docker tag simplyblock/spdkcsi:latest simplyblock/spdkcsi:$TAG | |
docker tag simplyblock/spdkcsi:latest simplyblock/spdkcsi:$TAG-$SHORT_SHA | |
docker push simplyblock/spdkcsi:$TAG | |
docker push simplyblock/spdkcsi:$TAG-$SHORT_SHA | |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
docker tag simplyblock/spdkcsi:$TAG simplyblock/spdkcsi:latest | |
docker push simplyblock/spdkcsi:latest | |
fi |