Skip to content

Commit ebbea56

Browse files
committed
Add daily cron job to test dotnet
1 parent 2a5ef7f commit ebbea56

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

.github/workflows/ci.yml

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: Build and test
2+
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
ref:
8+
required: true
9+
description: "GitHub ref to use"
10+
type: string
11+
secrets:
12+
PULUMI_ACCESS_TOKEN_PRODUCTION:
13+
required: true
14+
description: "Pulumi access token, required to run tests against the service"
15+
GITHUB_TOKEN:
16+
required: true
17+
description: "GitHub token"
18+
CODECOV_TOKEN:
19+
required: true
20+
description: "Codecov token"
21+
22+
env:
23+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN_PRODUCTION }}
24+
AWS_REGION: us-west-2
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PULUMI_TEST_OWNER: "moolumi"
27+
28+
jobs:
29+
setup_matrix:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
matrix: ${{ steps.set-matrix.outputs.matrix }}
33+
steps:
34+
- id: set-matrix
35+
run: |
36+
os="${{ contains(github.event.pull_request.labels.*.name, 'ci/test') && 'ubuntu-latest macos-latest windows-latest' || 'ubuntu-latest' }}"
37+
echo "matrix={\"os\": $(echo $os | jq -cR 'split(" ")')}" >> $GITHUB_OUTPUT
38+
39+
format:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
- name: Setup dotnet SDK v6.0
45+
uses: actions/setup-dotnet@v4
46+
- name: Format Pulumi SDK
47+
run: dotnet run format-sdk verify
48+
49+
build:
50+
needs: setup_matrix
51+
strategy:
52+
matrix:
53+
os: ${{ fromJson(needs.setup_matrix.outputs.matrix).os }}
54+
dotnet-version: [6.0.x, 8.0.x]
55+
56+
runs-on: ${{ matrix.os }}
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v4
60+
- name: Setup dotnet SDK v6.0
61+
uses: actions/setup-dotnet@v4
62+
with:
63+
dotnet-version: ${{ matrix.dotnet-version }}
64+
- name: Install Pulumi CLI
65+
uses: pulumi/actions@v5
66+
with:
67+
pulumi-version: latest
68+
- name: Build Pulumi SDK
69+
run: dotnet run build-sdk
70+
- name: Workspace clean (are xml doc file updates committed?)
71+
uses: pulumi/git-status-check-action@v1
72+
- name: Test Pulumi SDK
73+
run: dotnet run test-sdk coverage
74+
- name: Test Pulumi Automation SDK
75+
run: dotnet run test-automation-sdk coverage
76+
- name: Upload coverage data
77+
uses: codecov/codecov-action@v4
78+
with:
79+
directory: coverage
80+
files: "*"
81+
fail_ci_if_error: false
82+
verbose: true
83+
token: ${{ secrets.CODECOV_TOKEN }}
84+
85+
integration-tests:
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
os: [ubuntu-latest, windows-latest, macos-13]
90+
dotnet-version: [6.0.x, 8.0.x]
91+
runs-on: ${{ matrix.os }}
92+
steps:
93+
- name: Set TARGET_FRAMEWORK
94+
shell: bash
95+
run: |
96+
if [[ "${{ matrix.dotnet-version }}" == "6.0.x" ]]; then
97+
echo "TARGET_FRAMEWORK=net6.0" >> $GITHUB_ENV
98+
elif [[ "${{ matrix.dotnet-version }}" == "8.0.x" ]]; then
99+
echo "TARGET_FRAMEWORK=net8.0" >> $GITHUB_ENV
100+
elif [[ "${{ matrix.dotnet-version }}" == "9.0.x" ]]; then
101+
echo "TARGET_FRAMEWORK=net9.0" >> $GITHUB_ENV
102+
else
103+
echo "Unexpected dotnet-version: ${{ matrix.dotnet-version }}"
104+
exit 1
105+
fi
106+
- name: Checkout code
107+
uses: actions/checkout@v4
108+
- name: Setup dotnet SDK v6.0
109+
uses: actions/setup-dotnet@v4
110+
with:
111+
dotnet-version: ${{ matrix.dotnet-version }}
112+
- name: Set up Go 1.22.x
113+
uses: actions/setup-go@v5
114+
with:
115+
go-version: 1.22.x
116+
- name: Install Pulumi CLI
117+
uses: pulumi/actions@v5
118+
with:
119+
pulumi-version: latest
120+
- name: Install gotestsum
121+
uses: jaxxstorm/[email protected]
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
with:
125+
repo: gotestyourself/gotestsum
126+
tag: v1.8.1
127+
cache: enable
128+
- name: Install netcoredbg (Linux)
129+
if: matrix.os == 'ubuntu-latest'
130+
run: |
131+
curl -sSL https://github.com/Samsung/netcoredbg/releases/download/3.1.1-1042/netcoredbg-linux-amd64.tar.gz -o netcoredbg.tar.gz
132+
tar xzf netcoredbg.tar.gz
133+
sudo cp netcoredbg/* /usr/bin/
134+
- uses: MinoruSekine/[email protected]
135+
if: matrix.os == 'windows-latest'
136+
with:
137+
buckets: extras
138+
apps: doxygen plantuml
139+
- name: Install netcoredbg (Windows)
140+
if: matrix.os == 'windows-latest'
141+
run: |
142+
scoop install netcoredbg
143+
- name: Install netcoredbg (MacOS)
144+
if: matrix.os == 'macos-13'
145+
id: netcoredbg
146+
run: |
147+
curl -sSL https://github.com/Samsung/netcoredbg/releases/download/3.1.1-1042/netcoredbg-osx-amd64.tar.gz -o netcoredbg.tar.gz
148+
tar xzf netcoredbg.tar.gz
149+
echo "netcoredbgpath=$(pwd)/netcoredbg/" >> ${GITHUB_OUTPUT}
150+
- name: Integration tests
151+
if: matrix.os == 'macos-13'
152+
run: PATH="${{ steps.netcoredbg.outputs.netcoredbgpath}}":"$PATH" make test_integration
153+
- name: Integration tests
154+
if: matrix.os != 'macos-13'
155+
run: make test_integration
156+
157+
check-pr:
158+
needs: ["build", "integration-tests", "format"]
159+
runs-on: ubuntu-latest
160+
if: always() # always report a status
161+
steps:
162+
- name: Build failed
163+
if: ${{ needs.build.result != 'success' }}
164+
run: exit 1
165+
- name: Integration tests failed
166+
if: ${{ needs.integration-tests.result != 'success' }}
167+
run: exit 1
168+
- name: Format failed
169+
if: ${{ needs.format.result != 'success' }}
170+
run: exit 1
171+
- name: CI succeeded
172+
run: exit 0

.github/workflows/cron.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Daily cron testing
2+
3+
on:
4+
schedule:
5+
- cron: "27 5 * * *"
6+
7+
jobs:
8+
ci:
9+
name: CI
10+
uses: ./.github/workflows/ci.yml
11+
secrets: inherit
12+
with:
13+
ref: ${{ github.head_ref }}

0 commit comments

Comments
 (0)