-
Notifications
You must be signed in to change notification settings - Fork 18
152 lines (142 loc) · 4.9 KB
/
ci.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
name: CI
on:
push:
branches: ["main"]
pull_request:
permissions:
contents: read
jobs:
shell-lint:
runs-on: ubuntu-24.04
container:
image: koalaman/shellcheck-alpine:v0.9.0
steps:
- run: apk add git
- run: apk add shfmt --repository=http://dl-3.alpinelinux.org/alpine/edge/community
- uses: actions/checkout@v4
- name: shellcheck
run: shfmt -f . | grep -v ^test/ | xargs shellcheck
- name: shfmt
run: shfmt -f . | grep -v ^test/ | grep -v '_shpec.sh$' | xargs shfmt -d
rust-lint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Clippy
run: cargo clippy --all-targets --locked -- --deny warnings
- name: rustfmt
run: cargo fmt -- --check
rust-unit-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Run unit tests
run: cargo test --locked
find-libcnb-buildpacks:
name: Find libcnb buildpacks
runs-on: ubuntu-24.04
outputs:
libcnb-buildpacks: ${{ steps.find-buildpack-dirs.outputs.buildpacks }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- id: find-buildpack-dirs
name: Find libcnb buildpack directories
run: |
echo "buildpacks=$( \
find . -type d -execdir test -e "{}/buildpack.toml" -a -e "{}/Cargo.toml" \; -print \
| sort \
| uniq \
| jq -nRc '[inputs]
| map({ dir: ., name: split("/") | last | split("nodejs-") | last }
| [
. + { builder_tag: 20, arch: "amd64" },
. + { builder_tag: 22, arch: "amd64" },
. + { builder_tag: 24, arch: "amd64" },
. + { builder_tag: 24, arch: "arm64" }
])
| flatten' \
)" >> $GITHUB_OUTPUT
rust-integration-test:
name: ${{ matrix.name }} (${{ matrix.builder_tag }}, ${{ matrix.arch }})
runs-on: ${{ matrix.arch == 'arm64' && 'pub-hk-ubuntu-24.04-arm-medium' || 'ubuntu-24.04' }}
env:
INTEGRATION_TEST_CNB_BUILDER: heroku/builder:${{ matrix.builder_tag }}
needs: find-libcnb-buildpacks
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.find-libcnb-buildpacks.outputs.libcnb-buildpacks) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install musl-tools
run: sudo apt-get install musl-tools -y --no-install-recommends
- name: Update Rust toolchain
run: rustup update
- name: Install Rust linux-musl target
run: rustup target add ${{ matrix.arch == 'arm64' && 'aarch64-unknown-linux-musl' || 'x86_64-unknown-linux-musl' }}
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Install Pack CLI
uses: buildpacks/github-actions/[email protected]
- name: Pull builder image
run: docker pull ${{ env.INTEGRATION_TEST_CNB_BUILDER }}
- name: Pull run image
run: |
RUN_IMAGE=$(
docker inspect --format='{{index .Config.Labels "io.buildpacks.builder.metadata"}}' '${{ env.INTEGRATION_TEST_CNB_BUILDER }}' \
| jq --exit-status --raw-output '.stack.runImage.image'
)
docker pull "${RUN_IMAGE}"
- name: Run integration tests
working-directory: ${{ matrix.dir }}
run: cargo test --locked -- --ignored --test-threads 16
shpec:
runs-on: ubuntu-24.04
container:
image: heroku/heroku:${{ matrix.stack-version }}-build
strategy:
matrix:
stack-version:
- '20'
- '22'
buildpack-dir:
- buildpacks/npm
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install shpec
run: sh -c "`curl -L https://raw.githubusercontent.com/rylnd/shpec/master/install.sh`"
- name: Shpec unit tests on heroku-${{ matrix.stack-version }}
run: shpec ${{ matrix.buildpack-dir }}/shpec/*_shpec.sh
metrics-test:
strategy:
fail-fast: false
matrix:
# check the minimum node version supported by the metrics script and the latest node version
# (assumes the versions between have backwards-compatible APIs)
version: [14.10.0, latest]
name: Test Metrics (${{ matrix.version }})
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- run: npx mocha buildpacks/nodejs-engine/node_runtime_metrics/test/metrics.spec.cjs