feat: add unit test for GetDomains function #81
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: Build | |
on: [ push, pull_request ] | |
jobs: | |
coveralls: | |
name: Test with Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19' | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
go mod download | |
- name: Run Unit tests | |
run: | | |
go test -race -covermode atomic -coverprofile=covprofile ./... | |
- name: Install goveralls | |
run: go install github.com/mattn/goveralls@latest | |
- name: Send coverage | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: goveralls -coverprofile=covprofile -service=github | |
release-and-push: | |
name: Release And Push | |
runs-on: ubuntu-latest | |
if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' | |
needs: [ coveralls ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Fetch Previous version | |
id: get-previous-tag | |
uses: actions-ecosystem/action-get-latest-tag@v1.6.0 | |
- name: Run semantic-release | |
run: | | |
npm install --save-dev semantic-release@17.2.4 | |
npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Fetch Current version | |
id: get-current-tag | |
uses: actions-ecosystem/action-get-latest-tag@v1.6.0 | |
- name: Decide Should Push Or Not | |
id: should_push | |
run: | | |
old_version=${{steps.get-previous-tag.outputs.tag}} | |
new_version=${{steps.get-current-tag.outputs.tag }} | |
old_array=(${old_version//\./ }) | |
new_array=(${new_version//\./ }) | |
if [ ${old_array[0]} != ${new_array[0]} ] | |
then | |
echo ::set-output name=push::'true' | |
elif [ ${old_array[1]} != ${new_array[1]} ] | |
then | |
echo ::set-output name=push::'true' | |
else | |
echo ::set-output name=push::'false' | |
fi | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Log in to Docker Hub | |
uses: docker/#-action@v1 | |
if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' && steps.should_push.outputs.push=='true' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v3 | |
if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' && steps.should_push.outputs.push=='true' | |
with: | |
target: STANDARD | |
platforms: linux/amd64 | |
push: true | |
tags: casbin/casbin-server:${{steps.get-current-tag.outputs.tag }},casbin/casbin-server:latest |