mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 10:34:01 +03:00
+33
-11
@@ -48,6 +48,16 @@ jobs:
|
||||
- uses: jdx/mise-action@v3
|
||||
name: Install mise
|
||||
|
||||
- name: Cache Go modules and build
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Run tests
|
||||
run: mise tasks run covtest
|
||||
|
||||
@@ -69,6 +79,16 @@ jobs:
|
||||
- uses: jdx/mise-action@v3
|
||||
name: Install mise
|
||||
|
||||
- name: Cache Go modules and build
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Run fuzzing
|
||||
run: mise tasks run 'test:fuzz:*'
|
||||
|
||||
@@ -86,6 +106,16 @@ jobs:
|
||||
- uses: jdx/mise-action@v3
|
||||
name: Install mise
|
||||
|
||||
- name: Cache Go modules and build
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Run linter
|
||||
run: mise tasks run lint
|
||||
|
||||
@@ -123,14 +153,6 @@ jobs:
|
||||
- name: Setup BuildX
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: /tmp/buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
@@ -147,7 +169,7 @@ jobs:
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
pull: true
|
||||
context: .
|
||||
@@ -155,5 +177,5 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/buildx-cache
|
||||
cache-to: type=local,dest=/tmp/buildx-cache
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
+2
-2
@@ -33,11 +33,11 @@ run = "govulncheck ./..."
|
||||
|
||||
[tasks.test]
|
||||
description = "Run tests"
|
||||
run = "go test -v ./..."
|
||||
run = "go test -v -race ./..."
|
||||
|
||||
[tasks.covtest]
|
||||
description = "Run tests with code coverage"
|
||||
run = "go test -coverprofile=coverage.txt -covermode=atomic -parallel 2 -race -v ./..."
|
||||
run = "go test -coverprofile=coverage.txt -covermode=atomic -count=2 -race -v ./..."
|
||||
|
||||
[tasks.test-all]
|
||||
description = "Run all tests"
|
||||
|
||||
+11
-6
@@ -5,14 +5,19 @@ FROM golang:1.26-alpine AS build
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
RUN set -x \
|
||||
&& apk --no-cache --update add \
|
||||
bash \
|
||||
ca-certificates \
|
||||
git
|
||||
RUN --mount=type=cache,target=/var/cache/apk \
|
||||
set -x \
|
||||
&& apk --update add \
|
||||
bash \
|
||||
ca-certificates \
|
||||
git
|
||||
|
||||
COPY go.mod go.sum /app/
|
||||
WORKDIR /app
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN set -x \
|
||||
&& version="$(git describe --exact-match HEAD 2>/dev/null || git describe --tags --always)" \
|
||||
|
||||
Reference in New Issue
Block a user