Skip to content

Commit

Permalink
chore: build all binaries, restructure reusable actions
Browse files Browse the repository at this point in the history
  • Loading branch information
joroshiba committed Feb 6, 2024
1 parent 093e579 commit 9ad9e00
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 57 deletions.
40 changes: 40 additions & 0 deletions .github/reusable/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reusable Binary Build && Push Workflow

on:
workflow_call:
inputs:
package-name:
required: true
type: string

env:
REGISTRY: ghcr.io

jobs:
upload-binaries:
if: startsWith(github.ref, format('refs/tags/{0}-v', inputs.package-name)) || github.event_name == 'workflow_dispatch'
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: buildjet-4vcpu-ubuntu-2004
build-tool: cargo
- target: aarch64-apple-darwin
os: macos-latest
build-tool: cargo
- target: x86_64-apple-darwin
os: macos-latest
build-tool: cargo
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: astria-${{ github.event.inputs.package-name }}
dry-run: ${{ !startsWith(github.ref, format('refs/tags/{0}-v', inputs.package-name)) }}
# (optional) Target triple, default is host triple.
target: ${{ matrix.target }}
# (optional) Tool to build binaries (cargo, cross, or cargo-zigbuild)
build-tool: ${{ matrix.build-tool }}
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4

pr_title:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: CondeNast/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
ignoreCommits: "true"

admin:
if: ${{ always() && !cancelled() }}
needs: [pr_title]
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
59 changes: 31 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,34 @@ on:

jobs:
# TODO: Make generic and run on any tagged release
upload-cli-binaries:
if: startsWith(github.ref, 'refs/tags/cli-v') || github.event_name == 'workflow_dispatch'
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: buildjet-4vcpu-ubuntu-2004
build-tool: cargo
- target: aarch64-apple-darwin
os: macos-latest
build-tool: cargo
- target: x86_64-apple-darwin
os: macos-latest
build-tool: cargo
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: taiki-e/upload-rust-binary-action@v1
with:
dry-run: ${{ !startsWith(github.ref, 'refs/tags/cli-v') }}
bin: astria-cli
# (optional) Target triple, default is host triple.
target: ${{ matrix.target }}
# (optional) Tool to build binaries (cargo, cross, or cargo-zigbuild)
build-tool: ${{ matrix.build-tool }}
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
cli:
uses: './.github/reusable/build.yml'
with:
package-name: 'cli'

conductor:
uses: './.github/reusable/build.yml'
with:
package-name: 'conductor'

composer:
uses: './.github/reusable/build.yml'
with:
package-name: 'conductor'

sequencer:
uses: './.github/reusable/build.yml'
with:
package-name: 'sequencer'

relayer:
uses: './.github/reusable/build.yml'
with:
package-name: 'sequencer-relayer'

build:
if: ${{ always() && !cancelled() }}
needs: [cli, composer, conductor, sequencer, relayer]
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
12 changes: 6 additions & 6 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ on:

jobs:
run_checker:
uses: ./.github/workflows/reusable-run-checker.yml
uses: ./.github/reusable/run-checker.yml

composer:
needs: run_checker
if: needs.run_checker.outputs.run_docker == 'true'
uses: './.github/workflows/reusable-docker-build.yml'
uses: './.github/reusable/docker-build.yml'
with:
package-name: composer
target-binary: astria-composer
Expand All @@ -37,7 +37,7 @@ jobs:
conductor:
needs: run_checker
if: needs.run_checker.outputs.run_docker == 'true'
uses: './.github/workflows/reusable-docker-build.yml'
uses: './.github/reusable/docker-build.yml'
with:
package-name: conductor
target-binary: astria-conductor
Expand All @@ -46,7 +46,7 @@ jobs:
sequencer:
needs: run_checker
if: needs.run_checker.outputs.run_docker == 'true'
uses: './.github/workflows/reusable-docker-build.yml'
uses: './.github/reusable/docker-build.yml'
with:
package-name: sequencer
target-binary: astria-sequencer
Expand All @@ -55,7 +55,7 @@ jobs:
sequencer-relayer:
needs: run_checker
if: needs.run_checker.outputs.run_docker == 'true'
uses: './.github/workflows/reusable-docker-build.yml'
uses: './.github/reusable/docker-build.yml'
with:
package-name: sequencer-relayer
target-binary: astria-sequencer-relayer
Expand All @@ -64,6 +64,6 @@ jobs:
docker:
if: ${{ always() && !cancelled() }}
needs: [composer, conductor, sequencer, sequencer-relayer]
uses: ./.github/workflows/reusable-success.yml
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
17 changes: 3 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@ on:

jobs:
run_checker:
uses: ./.github/workflows/reusable-run-checker.yml

pr_title:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: CondeNast/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
ignoreCommits: "true"
uses: ./.github/reusable/run-checker.yml

proto:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,8 +71,8 @@ jobs:
#.github
lint:
needs: [proto, rust, toml, markdown, pr_title]
needs: [proto, rust, toml, markdown]
if: ${{ always() && !cancelled() }}
uses: ./.github/workflows/reusable-success.yml
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
run_checker:
uses: ./.github/workflows/reusable-run-checker.yml
uses: ./.github/reusable/run-checker.yml

proto:
runs-on: ubuntu-latest
Expand All @@ -29,46 +29,46 @@ jobs:
conductor:
needs: run_checker
if: needs.run_checker.outputs.run_release_services == 'true'
uses: ./.github/workflows/reusable-cargo-version.yml
uses: ./.github/reusable/release-cargo.yml
with:
package-name: 'conductor'
display-name: 'Conductor'

composer:
needs: run_checker
if: needs.run_checker.outputs.run_release_services == 'true'
uses: ./.github/workflows/reusable-cargo-version.yml
uses: ./.github/reusable/release-cargo.yml
with:
package-name: 'composer'
display-name: 'Composer'

sequencer:
needs: run_checker
if: needs.run_checker.outputs.run_release_services == 'true'
uses: ./.github/workflows/reusable-cargo-version.yml
uses: ./.github/reusable/release-cargo.yml
with:
package-name: 'sequencer'
display-name: 'Sequencer'

sequencer-relayer:
needs: run_checker
if: needs.run_checker.outputs.run_release_services == 'true'
uses: ./.github/workflows/reusable-cargo-version.yml
uses: ./.github/reusable/release-cargo.yml
with:
package-name: 'sequencer-relayer'
display-name: 'Sequencer Relayer'

cli:
needs: run_checker
if: needs.run_checker.outputs.run_release_services == 'true'
uses: ./.github/workflows/reusable-cargo-version.yml
uses: ./.github/reusable/release-cargo.yml
with:
package-name: 'cli'
display-name: 'CLI'

release:
needs: [proto, conductor, composer, sequencer, sequencer-relayer, cli]
if: ${{ always() && !cancelled() }}
uses: ./.github/workflows/reusable-success.yml
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
run_checker:
uses: ./.github/workflows/reusable-run-checker.yml
uses: ./.github/reusable/run-checker.yml

protos-compiled:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -230,6 +230,6 @@ jobs:
test:
if: ${{ always() && !cancelled() }}
needs: [compiles, protos-compiled, rust, doctest, clippy, lockfile, custom-lints, cargo-toml-synced-with-containerfiles]
uses: ./.github/workflows/reusable-success.yml
uses: ./.github/reusable/success.yml
with:
success: ${{ !contains(needs.*.result, 'failure') }}
5 changes: 5 additions & 0 deletions crates/astria-composer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ version = "0.3.1"
edition = "2021"
rust-version = "1.70.0"

[[bin]]
name = "astria-composer"
test = false
bench = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
5 changes: 5 additions & 0 deletions crates/astria-conductor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ version = "0.11.1"
edition = "2021"
rust-version = "1.73"

[[bin]]
name = "astria-conductor"
test = false
bench = false

[dependencies]
async-trait = "0.1.73"

Expand Down
5 changes: 5 additions & 0 deletions crates/astria-sequencer-relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.73"

[[bin]]
name = "astria-sequencer-relayer"
test = false
bench = false

[dependencies]
dirs = "5.0"
http = "0.2.9"
Expand Down
5 changes: 5 additions & 0 deletions crates/astria-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ version = "0.8.0"
edition = "2021"
rust-version = "1.73.0"

[[bin]]
name = "astria-sequencer"
test = false
bench = false

[dependencies]
"astria-core" = { path = "../astria-core" }
config = { package = "astria-config", path = "../astria-config" }
Expand Down

0 comments on commit 9ad9e00

Please sign in to comment.