move tests to gh actions (#9461)
This commit is contained in:
parent
2db8552a87
commit
3916f7b8b7
8 changed files with 72 additions and 11 deletions
57
.github/workflows/ci.yaml
vendored
57
.github/workflows/ci.yaml
vendored
|
@ -75,6 +75,63 @@ jobs:
|
||||||
# G307 TODO: Deferring unsafe method "Close"
|
# G307 TODO: Deferring unsafe method "Close"
|
||||||
args: -exclude=G109,G601,G104,G204,G304,G306,G307 -tests=false -exclude-dir=test -exclude-dir=images/ -exclude-dir=docs/ ./...
|
args: -exclude=G109,G601,G104,G204,G304,G306,G307 -tests=false -exclude-dir=test -exclude-dir=images/ -exclude-dir=docs/ ./...
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: |
|
||||||
|
(needs.changes.outputs.go == 'true')
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
id: go
|
||||||
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||||
|
with:
|
||||||
|
go-version: '1.19'
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Run Lint
|
||||||
|
run: ./hack/verify-golint.sh
|
||||||
|
|
||||||
|
gofmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: |
|
||||||
|
(needs.changes.outputs.go == 'true')
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
id: go
|
||||||
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||||
|
with:
|
||||||
|
go-version: '1.19'
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Run go-fmt
|
||||||
|
run: ./hack/verify-gofmt.sh
|
||||||
|
|
||||||
|
test-go:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: |
|
||||||
|
(needs.changes.outputs.go == 'true')
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
id: go
|
||||||
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||||
|
with:
|
||||||
|
go-version: '1.19'
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Run test
|
||||||
|
run: make test
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -141,6 +141,7 @@ test: ## Run go unit tests.
|
||||||
COMMIT_SHA=$(COMMIT_SHA) \
|
COMMIT_SHA=$(COMMIT_SHA) \
|
||||||
REPO_INFO=$(REPO_INFO) \
|
REPO_INFO=$(REPO_INFO) \
|
||||||
TAG=$(TAG) \
|
TAG=$(TAG) \
|
||||||
|
GOFLAGS="-buildvcs=false" \
|
||||||
test/test.sh
|
test/test.sh
|
||||||
|
|
||||||
.PHONY: lua-test
|
.PHONY: lua-test
|
||||||
|
|
|
@ -149,6 +149,7 @@ func ValidHeader(header string) bool {
|
||||||
// ValidCacheDuration checks if the provided string is a valid cache duration
|
// ValidCacheDuration checks if the provided string is a valid cache duration
|
||||||
// spec: [code ...] [time ...];
|
// spec: [code ...] [time ...];
|
||||||
// with: code is an http status code
|
// with: code is an http status code
|
||||||
|
//
|
||||||
// time must match the time regex and may appear multiple times, e.g. `1h 30m`
|
// time must match the time regex and may appear multiple times, e.g. `1h 30m`
|
||||||
func ValidCacheDuration(duration string) bool {
|
func ValidCacheDuration(duration string) bool {
|
||||||
elements := strings.Split(duration, " ")
|
elements := strings.Split(duration, " ")
|
||||||
|
|
|
@ -287,6 +287,7 @@ var (
|
||||||
// escapeLiteralDollar will replace the $ character with ${literal_dollar}
|
// escapeLiteralDollar will replace the $ character with ${literal_dollar}
|
||||||
// which is made to work via the following configuration in the http section of
|
// which is made to work via the following configuration in the http section of
|
||||||
// the template:
|
// the template:
|
||||||
|
//
|
||||||
// geo $literal_dollar {
|
// geo $literal_dollar {
|
||||||
// default "$";
|
// default "$";
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -41,6 +41,7 @@ func (m Mock) GetSecret(string) (*apiv1.Secret, error) {
|
||||||
|
|
||||||
// GetAuthCertificate resolves a given secret name into an SSL certificate.
|
// GetAuthCertificate resolves a given secret name into an SSL certificate.
|
||||||
// The secret must contain 3 keys named:
|
// The secret must contain 3 keys named:
|
||||||
|
//
|
||||||
// ca.crt: contains the certificate chain used for authentication
|
// ca.crt: contains the certificate chain used for authentication
|
||||||
func (m Mock) GetAuthCertificate(string) (*AuthSSLCert, error) {
|
func (m Mock) GetAuthCertificate(string) (*AuthSSLCert, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
@ -33,6 +33,7 @@ import (
|
||||||
// NumCPU returns the number of logical CPUs usable by the current process.
|
// NumCPU returns the number of logical CPUs usable by the current process.
|
||||||
// If CPU cgroups limits are configured, use cfs_quota_us / cfs_period_us
|
// If CPU cgroups limits are configured, use cfs_quota_us / cfs_period_us
|
||||||
// as formula
|
// as formula
|
||||||
|
//
|
||||||
// https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
|
// https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
|
||||||
func NumCPU() int {
|
func NumCPU() int {
|
||||||
cpus := runtime.NumCPU()
|
cpus := runtime.NumCPU()
|
||||||
|
|
|
@ -40,7 +40,6 @@ for dir in "${writeDirs[@]}"; do
|
||||||
chown -R www-data.www-data ${dir};
|
chown -R www-data.www-data ${dir};
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
mkdir -p /chroot/lib /chroot/proc /chroot/usr /chroot/bin /chroot/dev /chroot/run
|
mkdir -p /chroot/lib /chroot/proc /chroot/usr /chroot/bin /chroot/dev /chroot/run
|
||||||
cp /etc/passwd /etc/group /chroot/etc/
|
cp /etc/passwd /etc/group /chroot/etc/
|
||||||
cp -a /usr/* /chroot/usr/
|
cp -a /usr/* /chroot/usr/
|
||||||
|
|
Loading…
Reference in a new issue