-
-
Notifications
You must be signed in to change notification settings - Fork 313
153 lines (128 loc) · 4.34 KB
/
build-and-test.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Build/Test Pipeline
on:
push:
branches: [ master, setup-github-actions ]
workflow_dispatch:
# Cancel any in-progress build/test runs
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
environment: "Build Environment"
steps:
- name: Install fish
run: |
sudo apt-add-repository ppa:fish-shell/release-3 \
&& sudo apt-get -qq update \
&& sudo apt-get -qq install fish parallel
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Build and pack
run: fish .github/scripts/build.fish
shell: bash
env:
GITHUB_RUN_NUMBER: "${{ github.run_number }}"
ARTIFACT_DIR: "./artifacts"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
if-no-files-found: error
path: |
./artifacts/*.nupkg
./artifacts/*.snupkg
test-windows:
name: "Unit tests (.NET Framework)"
runs-on: "windows-latest"
needs: build
environment: "Unit test environment"
env:
SHOPIFYSHARP_ACCESS_TOKEN: "${{ secrets.SHOPIFYSHARP_ACCESS_TOKEN }}"
SHOPIFYSHARP_API_KEY: "${{ secrets.SHOPIFYSHARP_API_KEY }}"
SHOPIFYSHARP_SECRET_KEY: "${{ secrets.SHOPIFYSHARP_SECRET_KEY }}"
SHOPIFYSHARP_MY_SHOPIFY_URL: "${{ secrets.SHOPIFYSHARP_MY_SHOPIFY_URL }}"
SHOPIFYSHARP_ORG_ID: "${{ secrets.SHOPIFYSHARP_ORG_ID }}"
SHOPIFYSHARP_ORG_TOKEN: "${{ secrets.SHOPIFYSHARP_ORG_TOKEN }}"
steps:
- name: Checkout branch
uses: actions/checkout@master
- name: Execute .NET Framework unit tests
run: .github/scripts/test-dnf.ps1
shell: pwsh
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: framework-test-results
path: TestResults
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
test:
name: "Unit tests"
runs-on: ubuntu-22.04
# Do not run this job until the build job completes
needs: test-windows
environment: "Unit test environment"
env:
SHOPIFYSHARP_ACCESS_TOKEN: "${{ secrets.SHOPIFYSHARP_ACCESS_TOKEN }}"
SHOPIFYSHARP_API_KEY: "${{ secrets.SHOPIFYSHARP_API_KEY }}"
SHOPIFYSHARP_SECRET_KEY: "${{ secrets.SHOPIFYSHARP_SECRET_KEY }}"
SHOPIFYSHARP_MY_SHOPIFY_URL: "${{ secrets.SHOPIFYSHARP_MY_SHOPIFY_URL }}"
SHOPIFYSHARP_ORG_ID: "${{ secrets.SHOPIFYSHARP_ORG_ID }}"
SHOPIFYSHARP_ORG_TOKEN: "${{ secrets.SHOPIFYSHARP_ORG_TOKEN }}"
steps:
- name: Install fish
run: |
sudo apt-add-repository ppa:fish-shell/release-3 \
&& sudo apt-get -qq update \
&& sudo apt-get -qq install fish parallel
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Checkout branch
uses: actions/checkout@v4
- name: Execute unit test script
run: fish .github/scripts/test.fish
shell: bash
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: core-test-results
path: TestResults
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
publish:
name: "Publish prerelease packages"
runs-on: ubuntu-22.04
needs: test
environment: "Prerelease deployment environment"
# Only publish prerelease packages on the master branch
if: ${{ github.ref_name == 'master' }}
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
8.0.x
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: ./artifacts
- name: List files in artifacts folder
run: ls ./artifacts
- name: Publish package to Nuget
# Prerelease packages have a `-b*.nupkg` suffix
run: dotnet nuget push --skip-duplicate -k ${{ secrets.NUGET_TOKEN }} -s "https://api.nuget.org/v3/index.json" ./artifacts/*-b*.nupkg