Repository navigation
148 lines (138 loc) · 5.29 KB
/
Copy pathtest.yml
File metadata and controls
148 lines (138 loc) · 5.29 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
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
name: Test
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
ruby:
name: Ruby ${{ matrix.ruby }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
ruby:
- '3.1.2'
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Harden runner
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit # Audit network and disk activity
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Ruby
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install Libsodium on Windows
if: runner.os == 'Windows'
# this is a dependency of the ruby rbnacl library
# libsodium seems to be installed by default on macos and ubuntu runners
# https://github.com/RubyCrypto/rbnacl/wiki/Installing-libsodium#windows
run: |
cd "$env:temp"
Invoke-WebRequest "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18-msvc.zip" -OutFile "./libsodium.zip"
Expand-Archive ".\libsodium.zip"
Copy-Item ".\libsodium\libsodium\x64\Release\v142\dynamic\libsodium.dll" -Destination "C:\Windows\System32\sodium.dll"
shell: pwsh
- name: Lint
run: bundle exec rake standard
shell: bash
- name: Test
run: bundle exec rake test
shell: bash
go:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: Go (from go.mod) ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Harden runner
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit # Audit network and disk activity
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: set windows cgo flags
if: runner.os == 'Windows'
shell: bash
run: |
echo "CGO_CFLAGS=-IC:\mingw64\opt\include" >> "$GITHUB_ENV"
echo "CGO_LDFLAGS=-LC:\mingw64\opt\lib" >> "$GITHUB_ENV"
- name: set macos cgo flags
if: runner.os == 'macos'
run: |
echo CGO_CFLAGS="-I$(brew --prefix openssl)/include" >> "$GITHUB_ENV"
echo CGO_LDFLAGS="-L$(brew --prefix openssl)/lib" >> "$GITHUB_ENV"
- name: Lint
uses: step-security/golangci-lint-action@2697867e9c204558ca23d0decdd0039dc21f2b93 # v9.3.0
- name: Test
run: go test $(go list ./... | grep -v cross_language_tests) -race -cover
shell: bash
cross:
name: Cross - Go (from go.mod) Ruby ${{ matrix.ruby }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
ruby:
- '3.1.2'
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Harden runner
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit # Audit network and disk activity
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Set up Ruby
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install Libsodium on Windows
if: runner.os == 'Windows'
# this is a dependency of the ruby rbnacl library
# libsodium seems to be installed by default on macos and ubuntu runners
# https://github.com/RubyCrypto/rbnacl/wiki/Installing-libsodium#windows
run: |
cd "$env:temp"
Invoke-WebRequest "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18-msvc.zip" -OutFile "./libsodium.zip"
Expand-Archive ".\libsodium.zip"
Copy-Item ".\libsodium\libsodium\x64\Release\v142\dynamic\libsodium.dll" -Destination "C:\Windows\System32\sodium.dll"
shell: pwsh
- name: Set go C compiler on Windows
if: runner.os == 'Windows'
# the ruby installation adds a gcc and sets a path not compatible with tpm simulator
run: printf "CC=C:\ProgramData\chocolatey\bin\gcc.exe" >> "$GITHUB_ENV"
shell: bash
- name: Cross Language Tests
# ruby bundler leaves a `vendor` director here, which confuses go mod, so we need to explicitly disable it.
run: bundle exec go test ./cross_language_tests/... -mod=mod
shell: bash
mergeable:
runs-on: ubuntu-latest
steps:
- name: Harden runner
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with:
egress-policy: audit # Audit network and disk activity
- run: true
needs:
- ruby
- go
- cross