-
Notifications
You must be signed in to change notification settings - Fork 71
134 lines (134 loc) · 4.32 KB
/
pr_test.yml
File metadata and controls
134 lines (134 loc) · 4.32 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
name: Test
# Stop any in-flight CI jobs when a new commit is pushed.
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
jobs:
changelog:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
config:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install Rust"
uses: dtolnay/rust-toolchain@stable
- name: "Generate static app config"
run: make config
- name: "Config Artifact"
uses: actions/upload-artifact@v4
with:
name: config-artifact-${{ github.sha }}
path: pkg/config/config.toml
lint:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install Rust"
uses: dtolnay/rust-toolchain@stable
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x
- name: "Install dependencies"
run: make mod-download
shell: bash
- name: "Run go mod tidy"
run: make tidy
- name: "Run go fmt"
run: make fmt
# NOTE: We don't download the config artifact in this job.
# This is because we know Linux is able to generate the configuration file.
# Which is triggered by the `make vet` pre-requisite target `config`.
- name: "Run go vet"
run: make vet
shell: bash
- name: "Run revive"
run: make revive
shell: bash
- name: "Static analysis check"
run: make staticcheck
shell: bash
- name: "Security audit"
run: make gosec
shell: bash
- name: "Run go imports"
run: make imports
shell: bash
test:
needs: [config]
strategy:
matrix:
tinygo-version: [0.31.2]
go-version: [1.24.x]
node-version: [18]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install Go"
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# IMPORTANT: Disable caching to prevent cache restore errors later.
cache: false
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: "Install Rust"
uses: dtolnay/rust-toolchain@stable
- name: "Add wasm32-wasip1 Rust target"
run: rustup target add wasm32-wasip1 --toolchain stable
- name: "Validate Rust toolchain"
run: rustup show && rustup target list --installed --toolchain stable
shell: bash
- name: "Install Node"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: "Config Artifact"
uses: actions/download-artifact@v4
with:
name: config-artifact-${{ github.sha }}
- name: "Move Config"
run: mv config.toml pkg/config/config.toml
- name: "Modify git cloned repo files 'modified' times"
run: go run ./scripts/go-test-cache/main.go
# NOTE: Windows should fail quietly running pre-requisite target of `test`.
#
# On Windows, executing `make config` directly works fine.
# But when `config` is a pre-requisite to running `test`, it fails.
# But only when run via GitHub Actions.
# The ../../scripts/config.sh isn't run because you can't nest PowerShell instances.
# Each GitHub Action 'run' step is a PowerShell instance.
# And each instance is run as: powershell.exe -command ". '...'"
- name: "Test suite"
run: make test
shell: bash
env:
# NOTE: The following lets us focus the test run while debugging.
# TEST_ARGS: "-run TestBuild ./pkg/commands/compute/..."
TEST_COMPUTE_INIT: true
TEST_COMPUTE_BUILD: true
TEST_COMPUTE_DEPLOY: true
docker-builds:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: Build docker images
run: |
for dockerFile in Dockerfile*; do docker build -f $dockerFile . ; done