Skip to content

Commit a58ebfb

Browse files
committed
Add workflow for Github Actions
1 parent e11aefd commit a58ebfb

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: '* 4 * * *'
12+
13+
env:
14+
DOCKER_BUILDKIT: 1
15+
DOCKER_NETWORK: ${{ github.run_id }}
16+
DOCKER_NETWORK_ALIAS: nginx-plus-test
17+
DOCKER_NGINX_PLUS: nginx-plus-${{ github.run_id }}
18+
DOCKER_NGINX_PLUS_HELPER: nginx-plus-helper-${{ github.run_id }}
19+
GOLANG_VERSION: 1.14
20+
21+
jobs:
22+
23+
build:
24+
name: Build Go Client
25+
runs-on: ubuntu-18.04
26+
if: (github.repository == 'nginxinc/nginx-plus-go-client')
27+
steps:
28+
- name: Checkout Repository
29+
uses: actions/checkout@v2
30+
- name: Fetch Certificates
31+
env:
32+
CRT: ${{ secrets.NGINX_CRT }}
33+
KEY: ${{ secrets.NGINX_KEY }}
34+
run: |
35+
echo "${CRT}" | base64 --decode > docker/nginx-repo.crt
36+
echo "${KEY}" | base64 --decode > docker/nginx-repo.key
37+
- name: Setup Go Environment
38+
uses: actions/setup-go@v2
39+
with:
40+
go-version: '^${{ env.GOLANG_VERSION }}'
41+
- name: Import packages
42+
run: |
43+
go get -u github.com/nginxinc/nginx-plus-go-client/client
44+
go get -u github.com/nginxinc/nginx-plus-go-client/tests/helpers
45+
- name: Build & Test Client
46+
if: (github.event_name != 'schedule')
47+
run: make test
48+
- name: Switch Repository (Nightly)
49+
if: (github.event_name == 'schedule')
50+
run: |
51+
sed -i 's|plus-pkgs|pkgs-test|g' docker/Dockerfile
52+
sed -i '20,31d' docker/Dockerfile
53+
sed -i 's|deb https|deb [trusted=yes] https|g' docker/Dockerfile
54+
sed -i 's|nginx-plus=\${NGINX_PLUS_VERSION}|nginx-plus|g' docker/Dockerfile
55+
- name: Build & Test Client (Nightly)
56+
if: (github.event_name == 'schedule')
57+
run: make test
58+
env:
59+
NGINX_PLUS_VERSION: nightly

0 commit comments

Comments
 (0)