Skip to content

Commit

Permalink
Update dev to v34 (#29)
Browse files Browse the repository at this point in the history
* Update license exceptions for cargo-deny
* Use just-cargo util, eliminating justfile boilerplate

Signed-off-by: Oliver Gould <[email protected]>
  • Loading branch information
olix0r authored Nov 18, 2022
1 parent a5d92cf commit 06dccd8
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 69 deletions.
10 changes: 7 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "k8s-gateway-api",
"image": "ghcr.io/linkerd/dev:v32",
"image": "ghcr.io/linkerd/dev:v34",
"extensions": [
"DavidAnson.vscode-markdownlint",
"kokakiwi.vscode-just",
"NathanRidley.autotrim",
"rust-lang.rust-analyzer",
"skellock.just",
"samverschueren.final-newline",
"tamasfe.even-better-toml",
],
Expand All @@ -20,6 +20,10 @@
"overrideCommand": false,
"remoteUser": "code",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
{
"source": "/var/run/docker.sock",
"target": "/var/run/docker-host.sock",
"type": "bind"
}
]
}
8 changes: 4 additions & 4 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
actionlint:
runs-on: ubuntu-20.04
timeout-minutes: 10
container: ghcr.io/linkerd/dev:v32-tools
container: ghcr.io/linkerd/dev:v34-action
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- run: just action-lint
- run: just-dev lint-actions

devcontainer-versions:
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v32-tools
container: ghcr.io/linkerd/dev:v34-action
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- run: just action-dev-check
- run: just-dev check-action-images
28 changes: 21 additions & 7 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,46 @@ env:
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_VERSION: 1.64.0
K3D_VERSION: v5.4.4
K3D_VERSION: v5.4.6
K3D_CREATE_FLAGS: '--no-lb'
K3S_DISABLE: 'local-storage,traefik,servicelb,metrics-server@server:*'
NEXTEST_VERSION: '0.9.42'

jobs:
test:
strategy:
matrix:
k8s:
- v1.21
- v1.24
timeout-minutes: 5
- v1.25
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
# TODO(ver) Figure out how to use tools from the dev image.
- name: Install rust
run: |
rm -rf "$HOME/.cargo"
curl --proto =https --tlsv1.3 -fLsSv https://sh.rustup.rs | sh -s -- -y --default-toolchain "${RUST_VERSION}"
source "$HOME/.cargo/env"
echo "PATH=$PATH" >> "$GITHUB_ENV"
cargo version
- name: Install cargo-nextest
run: |
url="https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-${NEXTEST_VERSION}/cargo-nextest-${NEXTEST_VERSION}-x86_64-unknown-linux-gnu.tar.gz" ; \
curl --proto =https --tlsv1.3 -LsSv "$url" | tar zvxf - -C /usr/local/bin cargo-nextest
- name: Install dev utils
run: |
sha=574d6bab940a5fcfcd49169cd0b24ee72e2b5a04 # dev:v34
cd /usr/local/bin
for util in cargo k3d ; do
curl --proto =https --tlsv1.3 -fLsSvO "https://raw.githubusercontent.com/linkerd/dev/$sha/bin/just-$util"
chmod 755 "/usr/local/bin/just-$util"
done
- uses: extractions/setup-just@95b912dc5d3ed106a72907f2f9b91e76d60bdb76
# Setup a cluster
- run: curl --proto =https --tlsv1.3 -fLsSv "https://raw.githubusercontent.com/k3d-io/k3d/${K3D_VERSION}/install.sh" | bash
- run: k3d --version
- run: k3d cluster create --no-lb --k3s-arg '--no-deploy=local-storage,traefik,servicelb,metrics-server@server:*' --image +${{ matrix.k8s }}
- run: just-k3d K8S_VERSION=${{ matrix.k8s }} create
- run: kubectl version
# Install CRDs
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
Expand All @@ -46,11 +63,8 @@ jobs:
ref: 4f86f0bd65173b04dadb558f63fbbd53330736d2 # 0.5.0-rc1
path: gateway-api
- run: kubectl apply -k gateway-api/config/crd/experimental/
# Setup just
- uses: extractions/setup-just@95b912dc5d3ed106a72907f2f9b91e76d60bdb76
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
# Run tests
- run: just fetch
- run: just test-build --package=integration
- run: just test --package=integration

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
lint:
timeout-minutes: 5
runs-on: ubuntu-latest
container: docker://ghcr.io/linkerd/dev:v32-rust
container: docker://ghcr.io/linkerd/dev:v34-rust
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- run: just fetch
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ jobs:
run: |
ref=${{ github.ref }}
if [[ "$ref" == refs/tags/release/* ]]; then
echo ::set-output name=publish::true
echo ::set-output name=version::"${ref##refs/tags/release/}"
( echo version="${ref##refs/tags/release/}"
echo publish=true
) >> "$GITHUB_OUTPUT"
else
sha=${{ github.sha }}
echo ::set-output name=version::"test-${sha:0:7}"
( echo version="test-${sha:0:7}"
) >> "$GITHUB_OUTPUT"
fi
outputs:
publish: ${{ steps.meta.outputs.publish }}
Expand All @@ -39,7 +41,7 @@ jobs:
test:
timeout-minutes: 5
runs-on: ubuntu-latest
container: docker://ghcr.io/linkerd/dev:v32-rust
container: docker://ghcr.io/linkerd/dev:v34-rust
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- run: just fetch
Expand All @@ -53,17 +55,18 @@ jobs:
contents: write
timeout-minutes: 5
runs-on: ubuntu-latest
container: docker://ghcr.io/linkerd/dev:v32-rust
container: docker://ghcr.io/linkerd/dev:v34-rust
steps:
- if: needs.meta.outputs.publish
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- if: needs.meta.outputs.publish
shell: bash
run: |
version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "k8s-gateway-api") | .version')
just-cargo fetch
crate=$(just-cargo crate-version k8s-gateway-api)
tag="${{ needs.meta.outputs.version }}"
if [[ "v${version}" != "$tag" ]]; then
echo "::error ::Crate version v${version} does not match tag ${tag}"
if [[ "$crate" != "$tag" ]]; then
echo "::error ::Crate version ${crate} does not match tag ${tag}"
exit 1
fi
- if: needs.meta.outputs.publish
Expand All @@ -77,9 +80,10 @@ jobs:
needs: [meta, release]
timeout-minutes: 10
runs-on: ubuntu-latest
container: docker://ghcr.io/linkerd/dev:v32-rust
container: docker://ghcr.io/linkerd/dev:v34-rust
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- run: just publish --dry-run
- if: needs.meta.outputs.publish
- if: needs.meta.outputs.publish == ''
run: just publish --dry-run
- if: needs.meta.outputs.publish == 'true'
run: just publish --token=${{ secrets.CRATESIO_TOKEN }}
14 changes: 9 additions & 5 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ ignore = []

[licenses]
unlicensed = "deny"
allow = [
"Apache-2.0",
"MIT",
]
allow = ["Apache-2.0", "BSD-3-Clause", "MIT"]
deny = []
copyleft = "deny"
allow-osi-fsf-free = "neither"
default = "deny"
confidence-threshold = 0.8
exceptions = []

[[licenses.exceptions]]
# The Unicode-DFS-2016 license is necessary for unicode-ident because they
# use data from the unicode tables to generate the tables which are
# included in the application. We do not distribute those data files so
# this is not a problem for us. See https://github.com/dtolnay/unicode-ident/pull/9/files
name = "unicode-ident"
allow = ["Unicode-DFS-2016"]

[bans]
multiple-versions = "deny"
Expand Down
50 changes: 12 additions & 38 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,40 @@
export RUST_BACKTRACE := env_var_or_default("RUST_BACKTRACE", "short")
export RUSTFLAGS := env_var_or_default("RUSTFLAGS", "-D warnings -A deprecated")

toolchain := ""
cargo := "cargo" + if toolchain != "" { " +" + toolchain } else { "" }

# If we're running in Github Actions and cargo-action-fmt is installed, then add
# a command suffix that formats errors.
_fmt := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" } else {
```
if command -v cargo-action-fmt >/dev/null 2>&1; then
echo "--message-format=json | cargo-action-fmt"
fi
```
}

default: fetch deny lint test-build test

lint: check-fmt clippy docs md-lint action-lint action-dev-check

md-lint:
markdownlint-cli2 '**/*.md' '!**/node_modules' '!**/target'
markdownlint-cli2 '**/*.md' '!**/target'

fetch:
{{ cargo }} fetch
just-cargo fetch

check-fmt:
{{ cargo }} fmt -- --check
just-cargo fmt -- --check

clippy:
{{ cargo }} clippy --frozen --workspace --all-targets --all-features {{ _fmt }}
just-cargo clippy --frozen --workspace --all-targets --all-features

deny:
{{ cargo }} deny --all-features check
cargo-deny --all-features check

docs:
{{ cargo }} doc --frozen --no-deps --features=k8s-openapi/v1_24 {{ _fmt }}
just-cargo doc --frozen --no-deps --features=k8s-openapi/v1_25

test-build *flags:
{{ cargo }} test --no-run --frozen {{ flags }} {{ _fmt }}
just-cargo test-build --frozen {{ flags }}

test *flags:
{{ cargo }} test --frozen {{ flags }}
just-cargo test --frozen {{ flags }}

publish *flags:
{{ cargo }} publish --features=k8s-openapi/v1_24 {{ flags }}

cargo publish --features=k8s-openapi/v1_25 {{ flags }}

##
## GitHub Actions
##

# Format actionlint output for Github Actions if running in CI.
_actionlint-fmt := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" } else {
'{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}}::{{$err.Message}}%0A```%0A{{replace $err.Snippet "\\n" "%0A"}}%0A```\n{{end}}'
}

# Lints all GitHub Actions workflows
action-lint:
actionlint {{ if _actionlint-fmt != '' { "-format '" + _actionlint-fmt + "'" } else { "" } }} .github/workflows/*
just-dev lint-actions

# Ensure all devcontainer versions are in sync
action-dev-check:
action-dev-check

# vim: set ft=make :
just-dev check-action-images
just-dev pull-action-images

0 comments on commit 06dccd8

Please sign in to comment.