-
Notifications
You must be signed in to change notification settings - Fork 96
102 lines (97 loc) · 3.67 KB
/
test_upgrade.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
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: Test upgrade
on: [push, pull_request]
jobs:
populate-projects:
runs-on: ubuntu-latest
outputs:
projects_success: ${{ steps.set-matrix.outputs.projects_success }}
projects_fail: ${{ steps.set-matrix.outputs.projects_fail }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
shell: bash
run: |
echo "::set-output name=projects_success::$(ls .github/newt_upgrade/success/ | jq -R -s -c 'split("\n")[:-1]')"
echo "::set-output name=projects_fail::$(ls .github/newt_upgrade/fail/ | jq -R -s -c 'split("\n")[:-1]')"
test_upgrade_success:
name: newt upgrade (success)
needs: populate-projects
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
projects: ${{ fromJson(needs.populate-projects.outputs.projects_success) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Build newt
working-directory: newt
shell: bash
run: |
go version
go build
echo ${GITHUB_WORKSPACE}/newt >> $GITHUB_PATH
git config --global url."https://github.com/".insteadOf "git@github.com:"
- name: Test upgrade success
shell: bash
working-directory: .github/newt_upgrade/success/${{ matrix.projects }}
run: |
echo "Checking target ${{ matrix.targets }}"
echo "Test initial install"
newt upgrade
newt info | grep mynewt-dummy | diff -w expected.txt -
echo "Checking out repos to origin/master"
for repo in `ls repos`; do git -C repos/"$repo" checkout -q origin/master; done
echo "Test upgrade"
newt upgrade
newt info | grep mynewt-dummy | diff -w expected.txt -
test_upgrade_fail:
name: newt upgrade (fail)
needs: populate-projects
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
projects: ${{ fromJson(needs.populate-projects.outputs.projects_fail) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Build newt
working-directory: newt
shell: bash
run: |
go version
go build
echo ${GITHUB_WORKSPACE}/newt >> $GITHUB_PATH
git config --global url."https://github.com/".insteadOf "git@github.com:"
- name: Test upgrade fail
shell: bash
working-directory: .github/newt_upgrade/fail/${{ matrix.projects }}
run: |
echo "Checking target ${{ matrix.targets }}"
! newt upgrade &> tmp.txt
cat tmp.txt | tail -n `wc -l < expected.txt` | diff -w expected.txt -