-
Notifications
You must be signed in to change notification settings - Fork 11
134 lines (130 loc) · 4.7 KB
/
ci.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
name: Continuous Integration
on:
push:
branches: [master]
paths-ignore:
- '.github/no-response.yml'
- '.github/workflows/cd.yml'
- 'LICENSE'
- 'README.md'
- 'README.release.md'
pull_request:
branches: [master]
defaults:
run:
shell: bash
env:
PYTHON_DEFAULT_VERSION: '3.13'
GO_DEFAULT_VERSION: '1.22'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: deadsnakes/[email protected] # staticx doesn't work with python installed by setup-python action
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- name: Set up Go ${{ env.GO_DEFAULT_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_DEFAULT_VERSION }}
- name: Install dependencies
run: |
make deps
- name: Run dependency checker
run: |
make deps-check
- name: Run linters
run: |
make lint
- name: Run docs linters
run: |
make docs-lint
- name: Validate changelog
# Library was designed to be used with pull requests only.
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: zattoo/changelog@v2
with:
token: ${{ github.token }}
build:
needs: lint
runs-on: ${{ matrix.conf.runner }}
strategy:
fail-fast: false
matrix:
conf:
- { runner: ubuntu-latest, os: linux, arch: amd64 }
- { runner: macos-13, os: darwin, arch: amd64 }
- { runner: macos-14, os: darwin, arch: arm64 }
- { runner: windows-2019, os: windows, arch: amd64 }
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} (ubuntu-latest)
if: matrix.conf.os == 'linux'
uses: deadsnakes/[email protected] # staticx doesn't work with python installed by setup-python action
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
if: matrix.conf.os != 'linux'
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
- name: Set up Go ${{ env.GO_DEFAULT_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_DEFAULT_VERSION }}
- name: Install dependencies
run: |
make deps
- name: Build the provider
run: |
make build
- name: Upload python bindings
uses: actions/upload-artifact@v4
with:
name: py-terraform-provider-b2-${{ runner.os }}-${{ runner.arch }}
path: python-bindings/dist/py-terraform-provider-b2
if-no-files-found: error
retention-days: 1
test:
needs: build
env:
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
NOPYBINDINGS: 1 # do not build python buildings
runs-on: ${{ matrix.conf.runner }}
strategy:
fail-fast: false
matrix:
conf:
- { runner: ubuntu-latest, os: linux, arch: amd64, terraform: '1.9.*' }
- { runner: ubuntu-latest, os: linux, arch: amd64, terraform: '1.8.*' }
# for macOS, the latest terraform is enough for ACC tests
- { runner: macos-13, os: darwin, arch: amd64, terraform: '1.9.*' }
- { runner: macos-14, os: darwin, arch: arm64, terraform: '1.9.*' }
# for Windows, the latest terraform is enough for ACC tests
- { runner: windows-2019, os: windows, arch: amd64, terraform: '1.9.*' }
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ env.GO_DEFAULT_VERSION }}
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_DEFAULT_VERSION }}
- uses: hashicorp/setup-terraform@v3
name: Set up Terraform ${{ matrix.conf.terraform }}
with:
terraform_version: ${{ matrix.conf.terraform }}
terraform_wrapper: false
- name: Download python bindings for given OS
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
uses: actions/download-artifact@v4
with:
name: py-terraform-provider-b2-${{ runner.os }}-${{ runner.arch }}
path: python-bindings/dist/
- name: Run acceptance tests
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
timeout-minutes: 120
run: |
make testacc