mirror of
https://github.com/Lifailon/lazyjournal.git
synced 2026-11-11 01:09:46 +01:00
update test for docker without root
This commit is contained in:
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
Linux-root:
|
||||
Linux:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
@@ -47,8 +47,8 @@ jobs:
|
||||
- name: Install tailspin
|
||||
run: sudo apt install -y tailspin
|
||||
|
||||
- name: Run unit test in Linux
|
||||
run: sudo go test -v -cover -coverprofile linux-root-coverage.out
|
||||
- name: Run all unit test in Linux
|
||||
run: sudo go test -v -cover -coverprofile linux-coverage.out
|
||||
continue-on-error: true
|
||||
timeout-minutes: 5
|
||||
|
||||
@@ -67,10 +67,10 @@ jobs:
|
||||
- name: Upload coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-root-coverage
|
||||
path: linux-root-coverage.out
|
||||
name: linux-coverage
|
||||
path: linux-coverage.out
|
||||
|
||||
Linux:
|
||||
Docker:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
@@ -101,16 +101,16 @@ jobs:
|
||||
docker-compose up -d
|
||||
docker run -d --name pinguem -p 8085:8085 -p 3005:3005 lifailon/pinguem:latest
|
||||
|
||||
- name: Run unit test docker without root in Linux
|
||||
run: go test -v --run "TestDockerContainer" -cover -coverprofile linux-coverage.out
|
||||
- name: Run unit test for docker in Linux without root
|
||||
run: go test -v --run "TestDockerContainer" -cover -coverprofile docker-coverage.out
|
||||
continue-on-error: true
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-coverage
|
||||
path: linux-coverage.out
|
||||
name: docker-coverage
|
||||
path: docker-coverage.out
|
||||
|
||||
macOS:
|
||||
runs-on: macos-15
|
||||
@@ -209,7 +209,7 @@ jobs:
|
||||
|
||||
Merge:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Linux-root, Linux, macOS, Windows]
|
||||
needs: [Linux, Docker, macOS, Windows]
|
||||
steps:
|
||||
- name: Clone main repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -219,18 +219,18 @@ jobs:
|
||||
with:
|
||||
go-version: 1.23
|
||||
|
||||
- name: Download coverage report for Linux (root)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux-root-coverage
|
||||
path: .
|
||||
|
||||
- name: Download coverage report for Linux (without root)
|
||||
- name: Download coverage report for Linux (with root)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux-coverage
|
||||
path: .
|
||||
|
||||
- name: Download coverage report for Docker without root
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: docker-coverage
|
||||
path: .
|
||||
|
||||
- name: Download coverage report for macOS
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@@ -243,12 +243,12 @@ jobs:
|
||||
name: windows-coverage
|
||||
path: .
|
||||
|
||||
- name: Check coverage report for Linux (root)
|
||||
run: go tool cover -func linux-root-coverage.out
|
||||
|
||||
- name: Check coverage report for Linux (without root)
|
||||
- name: Check coverage report for Linux with root
|
||||
run: go tool cover -func linux-coverage.out
|
||||
|
||||
- name: Check coverage report for Docker without root
|
||||
run: go tool cover -func docker-coverage.out
|
||||
|
||||
- name: Check coverage report for macOS
|
||||
run: go tool cover -func macos-coverage.out
|
||||
|
||||
@@ -264,7 +264,7 @@ jobs:
|
||||
|
||||
- name: Merge coverage reports
|
||||
run: |
|
||||
gocovmerge linux-root-coverage.out linux-coverage.out macos-coverage.out windows-coverage.out > merge-coverage.out
|
||||
gocovmerge linux-coverage.out docker-coverage.out macos-coverage.out windows-coverage.out > merge-coverage.out
|
||||
go tool cover -func merge-coverage.out
|
||||
|
||||
- name: Upload merge coverage report
|
||||
|
||||
@@ -26,17 +26,11 @@ lint: prep install-lint
|
||||
|
||||
list:
|
||||
@go test -list . ./...
|
||||
@echo To run the test use: make test n=TestMain
|
||||
@echo To run the selected test: make test n=TestMain
|
||||
|
||||
test: prep
|
||||
go test -v -cover --run $(n) ./...
|
||||
|
||||
actions-check:
|
||||
@act -n -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
|
||||
actions-run:
|
||||
@act -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
|
||||
build: prep
|
||||
@echo "Build version: $(VERSION)"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-linux-amd64
|
||||
|
||||
+12
-12
@@ -44,7 +44,7 @@ tasks:
|
||||
- go test -list . ./...
|
||||
- silent: true
|
||||
cmd: |
|
||||
echo To run the test use: task test -- TestMain
|
||||
echo To run the selected test: task test -- TestMain
|
||||
|
||||
test:
|
||||
desc: "Run the selected unit test"
|
||||
@@ -52,16 +52,6 @@ tasks:
|
||||
- task: prep
|
||||
- go test -v -cover --run {{.CLI_ARGS}} ./...
|
||||
|
||||
actions-check:
|
||||
desc: "Run GitHub Actions locally"
|
||||
cmds:
|
||||
- act -n -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
|
||||
actions-run:
|
||||
desc: "Run GitHub Actions locally"
|
||||
cmds:
|
||||
- act -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
|
||||
build:
|
||||
desc: "Build"
|
||||
vars:
|
||||
@@ -79,4 +69,14 @@ tasks:
|
||||
- CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o bin/lazyjournal-{{.VERSION}}-freebsd-amd64
|
||||
- CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -o bin/lazyjournal-{{.VERSION}}-freebsd-arm64
|
||||
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/lazyjournal-{{.VERSION}}-windows-amd64
|
||||
- CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o bin/lazyjournal-{{.VERSION}}-windows-arm64
|
||||
- CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o bin/lazyjournal-{{.VERSION}}-windows-arm64
|
||||
|
||||
actions-check:
|
||||
desc: "Run GitHub Actions locally"
|
||||
cmds:
|
||||
- act -n -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
|
||||
actions-run:
|
||||
desc: "Run GitHub Actions locally"
|
||||
cmds:
|
||||
- act -e .github/workflows/event.json -W .github/workflows/build.yml -P ubuntu-24.04=catthehacker/ubuntu:act-latest --reuse --artifact-server-path $PWD/artifacts
|
||||
Reference in New Issue
Block a user