This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (73 loc) · 2.59 KB
/
ci_release.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
name: Release
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Semver type of new version (major / minor / patch)"
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major
jobs:
# Run the linting and tests
hadolint:
uses: SkynetLabs/.github/.github/workflows/reusable_dockerfile_lint.yml@master
tests:
runs-on: ubuntu-latest
container: openresty/openresty:1.21.4.1-focal
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
luarocks install lua-resty-http
luarocks install lua-resty-ipmatcher
luarocks install hasher
luarocks install busted
luarocks install luacov
luarocks install luacheck
- name: Lint Code With Luacheck
run: luacheck nginx/libs --std ngx_lua+busted
- name: Run Tests With Busted
# ran from root repo directory; produces luacov.stats.out file
run: testing/rbusted --lpath='nginx/libs/?.lua;nginx/libs/?/?.lua' --verbose --coverage --pattern=spec nginx/libs
- name: Generate Code Coverage Report With Luacov
# requires config file in cwd; produces luacov.report.out file
run: cp testing/.luacov . && luacov && rm .luacov
- uses: codecov/codecov-action@v3
with:
root_dir: ${GITHUB_WORKSPACE}
files: ./luacov.report.out
# Make a release if this is a manually trigger job, i.e. workflow_dispatch
release:
needs: [hadolint, tests]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
outputs:
new_version: ${{ steps.version.outputs.new-version }}
steps:
- uses: actions/checkout@v3
- name: Version Release
id: version
uses: SkynetLabs/.github/.github/actions/version-release@master
with:
github-token: ${{secrets.GITHUB_TOKEN}}
version-bump: ${{github.event.inputs.version}}
docker:
needs: release
name: Build and Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: SkynetLabs/.github/.github/actions/docker-publish@master
with:
docker_username: ${{ secrets.DOCKER_USERNAME}}
docker_password: ${{ secrets.DOCKER_PASSWORD}}
docker_repository: skynetlabs/webportal-nginx
semver_version: ${{ needs.release.outputs.new_version }}