forked from k-orc/openstack-resource-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2.12 KB
/
semver.yaml
File metadata and controls
66 lines (57 loc) · 2.12 KB
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
name: Semver analysis
on:
pull_request:
types:
- opened
- synchronize
- reopened
permissions:
contents: read
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Rebase the PR against base ref to ensure actual API compatibility
run: |
git config --global user.email "localrebase@k-orc.cloud"
git config --global user.name "Local rebase"
git rebase -i origin/$BASE_REF
env:
GIT_SEQUENCE_EDITOR: '/usr/bin/true'
BASE_REF: ${{ github.base_ref }}
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # tag=v6.3.0
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Checking Go API Compatibility
id: go-apidiff
# if semver=major, this will return RC=1, so let's ignore the failure so label
# can be set later. We check for actual errors in the next step.
continue-on-error: true
uses: joelanford/go-apidiff@60c4206be8f84348ebda2a3e0c3ac9cb54b8f685 # tag=v0.8.3
# go-apidiff returns RC=1 when semver=major, which makes the workflow to return
# a failure. Instead let's just return a failure if go-apidiff failed to run.
- name: Return an error if Go API Compatibility couldn't be verified
if: steps.go-apidiff.outcome != 'success' && steps.go-apidiff.outputs.semver-type != 'major'
run: exit 1
- name: Save semver result
if: always()
run: |
mkdir -p semver-results
echo "$SEMVER_TYPE" > semver-results/semver-type
env:
SEMVER_TYPE: ${{ steps.go-apidiff.outputs.semver-type }}
- name: Upload semver results
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # tag=v7
with:
name: semver-results
path: semver-results/