-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (121 loc) · 4.17 KB
/
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
name: Test
run-name: |
${{ (github.event_name == 'pull_request' && format('Test (PR #{0}): {1}', github.event.number, github.event.pull_request.title))
|| format('Test: {0}', github.event.head_commit.message) }}
on:
# Event: A maintainer has pushed commits or merged a PR to main.
push:
# Limiting push events to 'main' prevents duplicate runs of this workflow
# when maintainers push to internal PRs.
branches:
- main
# Event: A contributor has created or updated a PR.
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
jobs:
pr:
name: Pull Request Details
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
outputs:
branch: ${{ steps.pr-ref.outputs.branch || github.event.repository.default_branch }}
steps:
- name: PR Branch
id: pr-ref
shell: bash
run: echo "branch=$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')" | tee -a "$GITHUB_OUTPUT"
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.number }}
GH_TOKEN: ${{ github.token }}
- name: Diagnostics
shell: bash
run: |
echo "***** github.event:"
cat <<GITHUB_EVENT_JSON
${{toJSON(github.event)}}
GITHUB_EVENT_JSON
echo "***** github.repository:"
cat <<GITHUB_REPOSITORY_JSON
${{toJSON(github.repository)}}
GITHUB_REPOSITORY_JSON
echo "***** github.head_ref:"
echo 'ref: ${{ github.event_name == 'issue_comment' && github.head_ref }}'
echo "***** github.event.repository.default_branch:"
echo '${{ github.event.repository.default_branch }}'
build-all:
name: Build
if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:full-matrix') }}
needs: [pr]
permissions:
contents: write
uses: ./.github/workflows/build.yml
with:
ref: ${{ needs.pr.outputs.branch }}
update-version: true
github-release: false
bundles:
name: Check Bundles
runs-on: ubuntu-latest
steps:
- name: Diagnostics
shell: bash
run: |
cat <<GITHUB_EVENT_JSON
${{toJSON(github.event)}}
GITHUB_EVENT_JSON
- name: Checkout Code
uses: actions/checkout@v3
- name: Check Bundles
shell: bash
run: ./test/lint/check-bundles.sh
integration:
name: Integration Tests
needs: [bundles]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Neon Environment
id: neon
uses: ./.github/actions/setup-neon
with:
platform: linux-x64-gnu
workspace: ./pkgs/cargo-messages
- name: Install Dependencies
shell: bash
run: npm ci --verbose
- name: Build
shell: bash
env:
CARGO_BUILD_TARGET: ${{ steps.neon.outputs.target }}
NEON_BUILD_PLATFORM: linux-x64-gnu
run: npm run build
working-directory: ./pkgs/cargo-messages
- name: Pack
shell: bash
run: npm pack ./platforms/linux-x64-gnu --pack-destination=${{ runner.temp }}
working-directory: ./pkgs/cargo-messages
- name: Start npm Proxy
shell: bash
working-directory: ./test/integration/proxy
timeout-minutes: 3
run: ./ci-proxy.sh
- name: Publish to npm Proxy
shell: bash
working-directory: ./test/integration/proxy
timeout-minutes: 3
run: ./publish.sh linux-x64-gnu
# Since package integrity checksums may vary depending on what versions
# are available in the proxy registry, we don't put the lockfile for this
# test in source control. This means we have to use `npm i`, not `npm ci`.
- name: Setup test-sniff-bytes Integration Test
shell: bash
working-directory: test/integration/test-sniff-bytes
run: npm i || (cat ../proxy/proxy.log && exit 1)
- name: Run test-sniff-bytes Integration Test
shell: bash
working-directory: test/integration/test-sniff-bytes
run: npm test