Skip to content

Commit

Permalink
chore: fix GH release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hseeberger committed Aug 12, 2024
1 parent 0b65879 commit 97faa52
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 184 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
id: set_toolchain
run: |
toolchain=$(grep channel rust-toolchain.toml | sed -r 's/channel = "(.*)"/\1/')
echo "using toolchain $toolchain"
echo "toolchain=$toolchain" >> "$GITHUB_OUTPUT"
if [[ $toolchain =~ ^nightly.* ]]; then
echo "using nightly_toolchain $toolchain"
Expand Down
115 changes: 23 additions & 92 deletions .github/workflows/release-backend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release-hello-tracing-backend
name: Release backend

on:
push:
Expand All @@ -10,102 +10,32 @@ concurrency:
cancel-in-progress: true

jobs:
check:
toolchain:
runs-on: ubuntu-latest
env:
nightly: ${{(github.event.inputs.nightly == 'true' || github.event_name == 'schedule') && 'true' || ''}}
outputs:
toolchain: ${{steps.set_toolchain.outputs.toolchain}}
nightly_toolchain: ${{steps.set_toolchain.outputs.nightly_toolchain}}
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just check
run: just check

fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (nightly for fmt)
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- uses: Swatinem/rust-cache@v2

- name: just fmt-check
run: just fmt-check

lint:
runs-on: ubuntu-latest
needs: [check, fmt-check]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just lint
run: just lint

test:
runs-on: ubuntu-latest
needs: [check, fmt-check]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just test
run: just test
- name: Set toolchain
id: set_toolchain
run: |
toolchain=$(grep channel rust-toolchain.toml | sed -r 's/channel = "(.*)"/\1/')
echo "using toolchain $toolchain"
echo "toolchain=$toolchain" >> "$GITHUB_OUTPUT"
if [[ $toolchain =~ ^nightly.* ]]; then
echo "using nightly_toolchain $toolchain"
echo "nightly_toolchain=$toolchain" >> "$GITHUB_OUTPUT"
else
echo "using nightly_toolchain nightly"
echo "nightly_toolchain=nightly" >> "$GITHUB_OUTPUT"
fi
release:
runs-on: ubuntu-latest
needs: [lint, test]
needs: [toolchain]
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
Expand All @@ -129,8 +59,9 @@ jobs:
- name: Docker build and push hello-tracing-backend
uses: docker/build-push-action@v6
with:
push: true
file: hello-tracing-backend/Dockerfile
build-args: RUST_VERSION=${{needs.toolchain.outputs.toolchain}}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
115 changes: 23 additions & 92 deletions .github/workflows/release-gateway.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release-hello-tracing-gateway
name: Release gateway

on:
push:
Expand All @@ -10,102 +10,32 @@ concurrency:
cancel-in-progress: true

jobs:
check:
toolchain:
runs-on: ubuntu-latest
env:
nightly: ${{(github.event.inputs.nightly == 'true' || github.event_name == 'schedule') && 'true' || ''}}
outputs:
toolchain: ${{steps.set_toolchain.outputs.toolchain}}
nightly_toolchain: ${{steps.set_toolchain.outputs.nightly_toolchain}}
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just check
run: just check

fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (nightly for fmt)
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- uses: Swatinem/rust-cache@v2

- name: just fmt-check
run: just fmt-check

lint:
runs-on: ubuntu-latest
needs: [check, fmt-check]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just lint
run: just lint

test:
runs-on: ubuntu-latest
needs: [check, fmt-check]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2

- name: just test
run: just test
- name: Set toolchain
id: set_toolchain
run: |
toolchain=$(grep channel rust-toolchain.toml | sed -r 's/channel = "(.*)"/\1/')
echo "using toolchain $toolchain"
echo "toolchain=$toolchain" >> "$GITHUB_OUTPUT"
if [[ $toolchain =~ ^nightly.* ]]; then
echo "using nightly_toolchain $toolchain"
echo "nightly_toolchain=$toolchain" >> "$GITHUB_OUTPUT"
else
echo "using nightly_toolchain nightly"
echo "nightly_toolchain=nightly" >> "$GITHUB_OUTPUT"
fi
release:
runs-on: ubuntu-latest
needs: [lint, test]
needs: [toolchain]
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
Expand All @@ -129,8 +59,9 @@ jobs:
- name: Docker build and push hello-tracing-gateway
uses: docker/build-push-action@v6
with:
push: true
file: hello-tracing-gateway/Dockerfile
build-args: RUST_VERSION=${{needs.toolchain.outputs.toolchain}}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

0 comments on commit 97faa52

Please sign in to comment.