feat: test gitea actions with a real build!
All checks were successful
Build and test / Build (push) Successful in 2m10s

This commit is contained in:
Muyao CHEN 2024-10-08 23:22:00 +02:00
parent cc505e5a74
commit 8e73dc5f0b
5 changed files with 117 additions and 5 deletions

View File

@ -1,9 +1,31 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
# MIT License
#
# Copyright (c) 2024 vinchent <vinchent@vinchent.xyz>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Build and test
run-name: ${{ gitea.actor }} is building and testing the project!
on: [push]
jobs:
Explore-Gitea-Actions:
Build:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
@ -16,4 +38,18 @@ jobs:
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.23.1'
- run: go version
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: '1.25.0'
- run: sqlc version
- name: Build backend
run: make build
- name: Test backend
run: make test
- run: echo "🍏 This job's status is ${{ job.status }}."

View File

@ -29,7 +29,7 @@ GO_LDFLAGS += \
# ==============================================================================
.PHONY: all
all: add-copyright format build
web: web-all
# ==============================================================================
.PHONY: build
@ -45,7 +45,7 @@ format: # format code.
.PHONY: add-copyright
add-copyright: # add license to file headers.
@addlicense -v -f $(ROOT_DIR)/LICENSE $(ROOT_DIR) --skip-files=database.yml --skip-dirs=$(OUTPUT_DIR),deployment,migrations,configs,sqlc
@addlicense -v -f $(ROOT_DIR)/LICENSE $(ROOT_DIR) --skip-files=database.yml --skip-dirs=$(OUTPUT_DIR),deployment,migrations,configs,sqlc,web
.PHONY: swagger
swagger: # Run swagger.
@ -55,6 +55,22 @@ swagger: # Run swagger.
tidy: # Handle packkages.
@go mod tidy
.PHONY: test
test:
@go test ./...
.PHONY: clean
clean: # Clean up.
@-rm -vrf $(OUTPUT_DIR)
.PHONY: web-build
web-build:
$(MAKE) -C web build
.PHONY: web-test
web-test:
$(MAKE) -C web test
.PHONY: web-all
web-all:
$(MAKE) -C web all

View File

@ -26,6 +26,8 @@ It is a personal project to learn go and relative technologies.
---
[Gitea action](https://git.vinchent.xyz/vinchent/howmuch/actions/workflows/demo.yaml/badge.svg)
## Project Diary
### 2024/09/30
@ -310,3 +312,9 @@ them all the way along.
Moreover, even I am not really finishing the project, it can still be
something representable that I can show to a future interviewer.
### 2024/10/08
Gitea action setup ! 🎉🎉🎉
Next step is to run some check and build and test!

30
web/.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo

22
web/Makefile Normal file
View File

@ -0,0 +1,22 @@
.PHONY: all
all: add-copyright format lint build test
.PHONY: build
build:
@npm run build
.PHONY: format
format: # format code.
@npm run format
.PHONY: lint
lint:
@npm run lint
.PHONY: test
test:
@npm run test:unit run
.PHONY: add-copyright
add-copyright: # add license to file headers.
@addlicense -v -f ../LICENSE ./src --skip-files=database.yml