Skip to content

Commit

Permalink
ci: Use devcontainer; fix release workflow (#144)
Browse files Browse the repository at this point in the history
* Update the devcontainer version to v22
* Use devcontainers in CI for Rust and Go workflows
* Update the release automation workflow to do proper tag matching
  (since this repo doesn't use release/* prefixes).
* Remove install-protoc action

Signed-off-by: Oliver Gould <ver@buoyant.io>
  • Loading branch information
olix0r authored Aug 4, 2022
1 parent d052555 commit 8726026
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "linkerd2-proxy-api",
"image": "ghcr.io/linkerd/dev:v15",
"image": "ghcr.io/linkerd/dev:v22",
"extensions": [
"DavidAnson.vscode-markdownlint",
"golang.go",
"kokakiwi.vscode-just",
"NathanRidley.autotrim",
"rust-lang.rust-analyzer",
"samverschueren.final-newline",
"skellock.just",
"tamasfe.even-better-toml",
"zxh404.vscode-proto3"
],
Expand Down
32 changes: 0 additions & 32 deletions .github/actions/install-protoc/action.yml

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ jobs:
go:
timeout-minutes: 5
runs-on: ubuntu-latest
container: docker://ghcr.io/linkerd/dev:v22-go
steps:
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
with:
go-version: '1.17'
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: ./.github/actions/install-protoc
- run: just go-mod-check
- run: just go-gen-check
- run: just go-build
31 changes: 11 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ jobs:
meta:
timeout-minutes: 5
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
steps:
- id: meta
shell: bash
run: |
ref=${{ github.ref }}
if [[ "$ref" == refs/tags/release/* ]]; then
ref='${{ github.ref }}'
if [[ "$ref" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo ::set-output name=publish::true
echo ::set-output name=version::"${ref##refs/tags/release/}"
else
Expand All @@ -42,13 +40,9 @@ jobs:
test:
timeout-minutes: 5
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: olix0r/cargo-action-fmt@ed3530f0739c46ffa0dd983f8746b8c4a3d0a01c
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
- uses: ./.github/actions/install-protoc
- run: just rs-fetch
- run: just rs-gen-check
- run: just rs-test-build
Expand All @@ -61,19 +55,17 @@ jobs:
contents: write
timeout-minutes: 5
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- if: needs.meta.outputs.publish
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
- if: needs.meta.outputs.publish
shell: bash
run: |
curl --proto '=https' --tlsv1.3 -fsSL https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o $HOME/jq
chmod 755 $HOME/jq
version=$(cargo metadata --format-version=1 | $HOME/jq -r '.packages[] | select(.name == "linkerd2-proxy-api") | .version')
if [[ "v${version}" != "${{ needs.meta.outputs.version }}" ]]; then
echo "::error ::Crate version v${version} does not match tag ${{ needs.meta.outputs.version }}"
version=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "linkerd2-proxy-api") | .version')
expected='${{ needs.meta.outputs.version }}'
if [[ "v${version}" != "$expected" ]]; then
echo "::error ::Crate version v${version} does not match tag $expected"
exit 1
fi
- if: needs.meta.outputs.publish
Expand All @@ -87,11 +79,10 @@ jobs:
needs: [meta, release]
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: docker://rust:1.60.0-bullseye
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
- run: just rs-publish --dry-run
- if: '!needs.meta.outputs.publish'
run: just rs-publish --dry-run
- if: needs.meta.outputs.publish
run: just rs-publish --token=${{ secrets.CRATESIO_TOKEN }}
22 changes: 4 additions & 18 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,35 @@ jobs:
gen-check:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- uses: olix0r/cargo-action-fmt@ed3530f0739c46ffa0dd983f8746b8c4a3d0a01c
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: ./.github/actions/install-protoc
- run: just rs-fetch
- run: just rs-gen-check

rust-clippy:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- run: rustup component add clippy
- uses: olix0r/cargo-action-fmt@ed3530f0739c46ffa0dd983f8746b8c4a3d0a01c
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- run: just rs-fetch
- run: just rs-clippy

rust-docs:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- uses: olix0r/cargo-action-fmt@ed3530f0739c46ffa0dd983f8746b8c4a3d0a01c
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- run: just rs-fetch
- run: just rs-docs

rust-test:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: docker://rust:1.60
container: docker://ghcr.io/linkerd/dev:v22-rust
steps:
- uses: olix0r/cargo-action-fmt@ed3530f0739c46ffa0dd983f8746b8c4a3d0a01c
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- run: just rs-fetch
- run: just rs-test-build
Expand Down

0 comments on commit 8726026

Please sign in to comment.