feat: add swagger docs (#31) #105
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: Tiny-URL Actions | |
on: | |
push: | |
tags: | |
- v* | |
- main | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
lint: | |
name: Code Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
check-latest: true | |
cache-dependency-path: | | |
./go.sum | |
- name: Download Go Module | |
run: make bootstrap | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
test: | |
name: Unittest | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
check-latest: true | |
cache-dependency-path: | | |
./go.sum | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Run Unittest | |
run: make test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build_docker_image: | |
name: Build And Push Docker Image | |
needs: [ lint, test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# see https://github.com/actions/checkout/issues/1471 | |
with: | |
fetch-depth: 0 | |
filter: tree:0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build docker image | |
if: ${{ ! startsWith(github.ref, 'refs/tags/') }} | |
run: make build BUILD_PLATFORMS=linux/amd64 | |
- name: Login to Docker Hub | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: make build/docker_and_push |