Update module gorm.io/driver/mysql to v1.5.2 #594
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: Main | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- '**.jpg' | |
- '**.jpeg' | |
- '**.png' | |
- 'index.html' | |
jobs: | |
tests: | |
needs: [build_documentation] # Validates agains OpenAPI spec | |
runs-on: ubuntu-latest | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
container: | |
image: cubicrootxyz/matrix-go:1.21 | |
options: --user root | |
services: | |
database: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: mypass | |
MYSQL_DATABASE: remindme | |
env: | |
TEST_DB_HOST: database | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Run tests | |
run: go test ./... | |
lint: | |
runs-on: ubuntu-latest | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
container: | |
# Updated 1.21 image has some trouble, therefore stick with the old one | |
# until those are resolved. | |
image: cubicrootxyz/matrix-go:1.19 | |
options: --user root | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Run golangci | |
run: golangci-lint run --timeout 3m0s | |
build_documentation: | |
runs-on: ubuntu-latest | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
container: | |
image: cubicrootxyz/matrix-go:1.21 | |
options: --user root | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Get dependencies | |
run: go get ./... | |
- name: Build the api documentation | |
run: swag init --parseDependency=true -d . -g cmd/remindme/main.go | |
- name: Convert to OpenApi 3 | |
run: openapi-code-sample-generator convert --file docs/swagger.yaml --output-file docs/swagger3.yaml | |
- name: Add code samples to api documentation | |
run: openapi-code-sample-generator generate --input-file docs/swagger3.yaml --output-file docs/api-spec.yaml | |
- name: Build static html | |
run: npx redoc-cli bundle docs/api-spec.yaml --output index.html | |
- name: Archive rendered HTML | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rendered-api-docu | |
path: | | |
index.html | |
- name: Commit static html back | |
if: "${{ github.ref == 'refs/heads/main' }}" | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
build_and_push_image: | |
needs: [tests, lint, build_documentation] | |
runs-on: ubuntu-latest | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Build container | |
run: docker build -t cubicrootxyz/remindme:beta . | |
- name: Login to Docker Hub | |
if: "${{ github.ref == 'refs/heads/main' }}" | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push image | |
if: "${{ github.ref == 'refs/heads/main' }}" | |
run: docker push cubicrootxyz/remindme:beta | |