Repository navigation
110 lines (90 loc) · 3.14 KB
/
Copy pathtest.yml
File metadata and controls
110 lines (90 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Test
on:
push:
branches: ["main"]
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches: ["main"]
paths-ignore:
- "docs/**"
- "*.md"
workflow_dispatch:
jobs:
test-nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup build dependencies
uses: ./.github/actions/setup-build-deps
with:
go-version: "1.24"
node-version: "20"
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Create Fake WebUI Sources
run: |
mkdir -p webui/dist
# Create an empty gzip file for testing
gzip -c /dev/null > webui/dist/index.html.gz
- name: Build
run: go build -tags=sqlite3_dotlk ./...
- name: Test
run: PATH=$(pwd):$PATH gotestsum ./... -- --race -tags=sqlite3_dotlk
test-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup build dependencies
uses: ./.github/actions/setup-build-deps
with:
go-version: "1.24"
node-version: "20"
- name: Create Fake WebUI Sources
run: |
New-Item -Path .\webui\dist-windows\index.html -ItemType File -Force
- name: Resolve latest restic version
shell: powershell
id: restic-version
run: |
$latest = Invoke-RestMethod -Uri "https://api.github.com/repos/restic/restic/releases/latest"
$tag = $latest.tag_name
if ($tag.StartsWith("v")) {
$tag = $tag.Substring(1)
}
echo "RESTIC_VERSION=$tag" >> $env:GITHUB_ENV
- name: Cache restic
id: cache-restic
uses: actions/cache@v3
with:
path: restic-bin
key: restic-windows-${{ env.RESTIC_VERSION }}
- name: Download restic
if: steps.cache-restic.outputs.cache-hit != 'true'
shell: powershell
run: |
$tag = $env:RESTIC_VERSION
$url = "https://github.com/restic/restic/releases/download/v$tag/restic_${tag}_windows_amd64.zip"
$output = "restic.zip"
$dest = "restic-bin"
New-Item -ItemType Directory -Force -Path $dest
Write-Host "Downloading $url..."
Invoke-WebRequest -Uri $url -OutFile $output
Expand-Archive $output -DestinationPath temp_extract -Force
$extracted = Get-ChildItem -Recurse -Path temp_extract -Filter "restic*.exe" | Select-Object -First 1
if ($extracted) {
Move-Item $extracted.FullName -Destination "$dest\restic.exe" -Force
} else {
Write-Error "Could not find restic.exe"
}
Remove-Item -Recurse -Force temp_extract
Remove-Item -Force $output
- name: Add restic to PATH
run: echo "$PWD\restic-bin" >> $env:GITHUB_PATH
- name: Build
run: go build ./...
- name: Test
run: go test ./...