-
Notifications
You must be signed in to change notification settings - Fork 29
108 lines (103 loc) · 3.38 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# It's recommended to run golangci-lint in a job separate from other jobs (go test, etc) because different jobs run in parallel.
go-linter:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Pin the version in case all the builds start to fail at the same time.
# There may not be an automatic way (e.g., dependabot) to update a specific parameter of a GitHub Action,
# so we will just update it manually whenever it makes sense (e.g., a feature that we want is added).
version: v1.54.0
args: --fix=false --timeout=5m --out-format=colored-line-number
build:
strategy:
fail-fast: false
matrix:
go: [ '1.17', '1.18', '1.19', '1.20', '1.21' ]
os: [ 'ubuntu-22.04', 'windows-2022' ]
name: ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false
- name: build
run: make build
- name: test-unit
run: make test-unit
e2e-tests:
strategy:
fail-fast: false
matrix:
go: [ '1.20' ]
os: [ 'ubuntu-22.04' ]
name: ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ROLE }}
aws-region: ${{ secrets.REGION }}
- name: Fill credentials to default profile
shell: bash
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
aws configure set aws_session_token $AWS_SESSION_TOKEN --profile default
- name: install and start containerd
shell: bash
run: sudo scripts/install-containerd
- name: start ecs local endpoint
shell: bash
run: docker run -d --name ecs-local-endpoint -p 51679:51679 -v $HOME/.aws/:/home/.aws/ -e AWS_REGION=us-west-2 -e HOME="/home" -e AWS_PROFILE=default -e ECS_LOCAL_METADATA_PORT=51679 amazon/amazon-ecs-local-container-endpoints
- name: ip forwarding
shell: bash
run: sudo scripts/ip-forwarding
- name: build
run: make build
- name: test-e2e
run: sudo make test-e2e
go-mod-tidy-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
# TODO: Use `go mod tidy --check` after https://github.com/golang/go/issues/27005 is fixed.
- run: go mod tidy
- run: git diff --exit-code
mdlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: avto-dev/markdown-lint@v1
with:
args: '**/*.md'