-
Notifications
You must be signed in to change notification settings - Fork 80
135 lines (126 loc) · 3.85 KB
/
main.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * *' # run at 00:00 UTC
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.20.x', '1.21.x']
steps:
- uses: actions/checkout@v4
# first download wasmtime's last static library build using python
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python ci/download-wasmtime.py
# then run our go tests ...
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- run: go vet
- run: go test
- run: go test -tags debug
- run: go test -tags debug
env:
GODEBUG: cgocheck=1
GOGC: 1
- run: go clean -cache
- name: Test bazel build on *nix
shell: bash
run: |
export GOOS=$(go env GOHOSTOS)
go get github.com/bazelbuild/bazelisk
export PATH=$PATH:$(go env GOPATH)/bin
bazelisk build --subcommands=pretty_print --verbose_failures :go_default_library
bazelisk test --subcommands=pretty_print --verbose_failures :go_default_test
# TODO: need to fix bazel tests
if: matrix.os != 'windows-latest' && false
- name: Ready msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-toolchain
path-type: inherit
if: matrix.os == 'windows-latest'
- name: Test bazel build on Windows
shell: msys2 {0}
run: |
go get github.com/bazelbuild/bazelisk
bazelisk build --subcommands=pretty_print --verbose_failures --compiler=mingw-gcc :go_default_library
bazelisk test --subcommands=pretty_print --verbose_failures --compiler=mingw-gcc :go_default_test
# TODO: need to reenable when MinGW shenanigans are fixed
if: matrix.os == 'windows-latest' && false
- name: Test vendoring on *nix
shell: bash
run: ./ci/test-vendoring.sh
if: matrix.os != 'windows-latest'
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python ci/download-wasmtime.py
- uses: actions/setup-go@v2
with:
go-version: '1.20'
- run: go test -coverprofile cover.out ./...
- run: go tool cover -html=cover.out -o coverage.html
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.html
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v2
with:
go-version: '1.20'
# https://stackoverflow.com/questions/42510140/check-format-for-continous-integration
- run: "diff -u <(echo -n) <(gofmt -d ./)"
upload_docs:
needs: [coverage]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage
path: coverage
- run: find .
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/configure-pages@v5
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: "coverage"
deploy:
name: Deploy github-pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: upload_docs
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4