forked from dafny-lang/dafny
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (155 loc) · 5.97 KB
/
release-downloads-nuget.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
154
155
156
157
158
159
160
161
162
163
name: Test NuGet Packages
on:
release:
# This triggers in response to a GitHub release being published,
# which happens to work well because we do that well after first publishing
# to NuGet. That gives at least 10 or 15 minutes for the newly published versions
# of these packages to be available for download here.
#
# Unfortunately that also means this doesn't trigger on the nightly build release,
# since that ends up updating an existing "nightly-..." release rather than creating a new one.
# For now that's a good thing since these jobs only test the latest actual released version,
# but ideally we'd fix both of those issues so that we test the fully NuGet publishing
# workflow in the nightly build.
types: [ published ]
# For manual testing through the Actions UI
workflow_dispatch:
env:
dotnet-version: 6.0.x # SDK Version for running Dafny (TODO: should this be an older version?)
z3BaseUri: https://github.com/Z3Prover/z3/releases/download/Z3-4.8.5
jobs:
test-dafny-cli-tool:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# This workflow breaks on windows-2022: https://github.com/dafny-lang/dafny/issues/1906
os: [ ubuntu-latest, ubuntu-18.04, macos-latest, windows-2019 ]
include:
- os: 'ubuntu-latest'
osn: 'ubuntu\-16.04'
z3: z3-4.8.5-x64-ubuntu-16.04
- os: 'ubuntu-18.04'
osn: 'ubuntu\-16.04'
z3: z3-4.8.5-x64-ubuntu-16.04
- os: 'macos-latest'
osn: 'osx-.*'
z3: z3-4.8.5-x64-osx-10.14.2
- os: 'windows-2019'
osn: 'win'
z3: z3-4.8.5-x64-win
steps:
- name: OS
run: echo ${{ runner.os }} ${{ matrix.os }}
- name: Set up JDK 18
uses: actions/setup-java@v1
with:
java-version: 18
- name: Setup dotnet
uses: actions/[email protected]
with:
dotnet-version: ${{env.dotnet-version}}
- name: Load Z3
shell: pwsh
run: |
Invoke-WebRequest ${{env.z3BaseUri}}/${{matrix.z3}}.zip -OutFile z3.zip
Expand-Archive z3.zip .
Remove-Item z3.zip
- name: Set Z3 permissions
run: |
mkdir bin
mv ${{matrix.z3}}/bin/z3* bin/
chmod +x bin/z3*
- name: Set Path
if: runner.os != 'Windows'
run: echo "${PWD}/bin" >> $GITHUB_PATH
- name: Set Path - Windows
if: runner.os == 'Windows'
run: $((Resolve-Path -Path "bin").providerPath) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Download NuGet package
run: dotnet tool install --global Dafny
## Create a simple smoke test program
- name: Make test program
run: |
echo "method Main() { assert true; print 42, '\n'; }" > a.dfy
echo "method m() { assert false; }" > b.dfy
echo "42" > expect.txt
## Check that dafny and z3 run and that a simple program verifies or fails
- name: Versions
run: |
z3 -version
dafny -version
- name: Fatch latest release version string
id: dafny
continue-on-error: true
uses: pozetroninc/[email protected]
with:
repository: ${{ github.repository }}
excludes: prerelease, draft
- name: Verify Dafny version
if: "${{ steps.dafny.outputs.release != '' }}"
run: version="${{ steps.dafny.outputs.release }}"; dafny -version | grep -E "Dafny "${version:1}".[0-9]{5}"
shell: bash
- name: Check
run: dafny /compileVerbose:0 /compile:0 a.dfy
- name: Check bad
run: dafny /compile:0 b.dfy || echo "EXPECTED FAILURE" ; exit 0
## Check that a simple program compiles and runs on each supported platform
- name: Check C# compile
run: |
dafny /compileVerbose:0 /compile:3 /compileTarget:cs /spillTargetCode:3 a.dfy
- name: Check Go compile
run: |
dafny /compile:3 /spillTargetCode:3 /compileTarget:go a.dfy
- name: Running Go artifacts
if: runner.os != 'Windows'
run: |
GO111MODULE=auto GOPATH=$PWD/a-go go run a-go/src/a.go > actual.txt
diff expect.txt actual.txt
- name: Running Go artifacts - Windows
shell: pwsh
if: runner.os == 'Windows'
run: |
$Env:GO111MODULE="auto"
$Env:GOPATH="$PWD/a-go"
go run a-go/src/a.go > actual.txt
diff expect.txt actual.txt
- name: Check Javascript compile
run: |
npm install bignumber.js
dafny /compile:3 /spillTargetCode:3 /compileTarget:js a.dfy
node a.js dafny/DafnyRuntime.js > actual.txt
diff expect.txt actual.txt
- name: Check Java compile
run: |
dafny /compile:3 /spillTargetCode:3 /compileTarget:java a.dfy
test-dafny-libraries:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Hopefully we can automatically populate this list in the future,
# but note we need to skip Dafny since nuget install doesn't work for dotnet tools.
library-name: [ DafnyPipeline, DafnyServer, DafnyLanguageServer, DafnyRuntime, DafnyCore, DafnyDriver ]
# This workflow breaks on windows-2022: https://github.com/dafny-lang/dafny/issues/1906
os: [ ubuntu-latest, ubuntu-18.04, macos-latest, windows-2019 ]
include:
- os: 'ubuntu-latest'
osn: 'ubuntu\-16.04'
z3: z3-4.8.5-x64-ubuntu-16.04
- os: 'ubuntu-18.04'
osn: 'ubuntu\-16.04'
z3: z3-4.8.5-x64-ubuntu-16.04
- os: 'macos-latest'
osn: 'osx-.*'
z3: z3-4.8.5-x64-osx-10.14.2
- os: 'windows-2019'
osn: 'win'
z3: z3-4.8.5-x64-win
steps:
## Verify that the dependencies of the libraries we publish (e.g. DafnyLanguageServer)
## are also published through NuGet.
## Ideally we would have a test project that actually uses part of the public API of each package.
- name: Check library dependencies
run: |
nuget install -Prerelease ${{ matrix.library-name }}