fix(publisher): Rollback NATS_URL for Publisher #1416
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- edited | |
- reopened | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
CLICOLOR: 1 | |
RUST_NIGHTLY_VERSION: nightly-2024-11-06 | |
CI: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
install-deps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
cache: true | |
- name: Install nextest | |
uses: taiki-e/cache-cargo-install-action@v2 | |
with: | |
tool: cargo-nextest | |
locked: true | |
- name: Install dependencies | |
run: cargo fetch | |
test: | |
needs: install-deps | |
name: Test ${{ matrix.package }} | |
runs-on: ubuntu-latest | |
env: | |
NATS_URL: nats://127.0.0.1:4222 | |
NATS_ADMIN_PASS: secret | |
NATS_PUBLIC_PASS: secret | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
# - fuel-data-parser | |
# - fuel-indexer | |
- fuel-streams | |
- fuel-streams-core | |
- fuel-streams-macros | |
- fuel-streams-publisher | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
- name: Install nextest | |
uses: taiki-e/cache-cargo-install-action@v2 | |
with: | |
tool: cargo-nextest | |
locked: true | |
- name: Start Nats | |
run: | | |
make start/nats | |
- name: Run tests | |
run: make test PROFILE=ci TEST_PROJECT=${{ matrix.package }} | |
- name: Stop Nats | |
if: always() | |
run: make stop/nats | |
build: | |
needs: test | |
name: Build ${{ matrix.package }} for ${{ matrix.platform.target }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
- fuel-streams-publisher | |
is_release: | |
- ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} | |
platform: | |
# linux x86_64 | |
- os_name: Linux-x86_64-gnu | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
build_on_pr: true | |
- os_name: Linux-x86_64-musl | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
build_on_pr: false | |
# linux aarch64 | |
- os_name: Linux-aarch64-gnu | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
build_on_pr: false | |
- os_name: Linux-aarch64-musl | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
build_on_pr: false | |
# macOS | |
- os_name: macOS-x86_64 | |
os: macOS-latest | |
target: x86_64-apple-darwin | |
build_on_pr: true | |
- os_name: macOS-aarch64 | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
build_on_pr: false | |
exclude: | |
- is_release: false | |
platform: {build_on_pr: false} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
target: ${{ matrix.platform.target }} | |
cache: false | |
- name: Install packages (macOS) | |
if: matrix.platform.os == 'macOS-latest' | |
run: | | |
brew install llvm | |
- name: Install cross | |
if: matrix.platform.os != 'macOS-latest' | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cross | |
cache-key: ${{ matrix.platform.target }} | |
git: https://github.com/cross-rs/cross | |
- name: Build with cross for Linux | |
if: matrix.platform.os != 'macOS-latest' | |
run: | | |
cross build --release --locked --target ${{ matrix.platform.target }} --package ${{ matrix.package }} | |
- name: Build with cargo for MacOS | |
if: matrix.platform.os == 'macOS-latest' | |
run: | | |
rustup target add ${{ matrix.platform.target }} | |
cargo build --release --locked --target ${{ matrix.platform.target }} --package ${{ matrix.package }} | |
- name: Strip binaries | |
run: ./scripts/strip-binary.sh "${{ matrix.platform.target }}" | |
- name: Set Artifact Name | |
id: artifact-name | |
shell: bash | |
run: | | |
echo "value=${{ matrix.package }}-${{ matrix.platform.os_name }}" >> $GITHUB_OUTPUT | |
- name: Package as archive | |
shell: bash | |
run: | | |
cd target/${{ matrix.platform.target }}/release | |
tar czvf ../../../${{ steps.artifact-name.outputs.value }}.tar.gz ${{ matrix.package }} | |
cd - | |
- name: Publish release artifacts | |
uses: actions/upload-artifact@v4 | |
if: >- | |
(github.event_name == 'push' && | |
github.ref == 'refs/heads/main' && | |
contains(github.event.head_commit.message, 'ci(release): Preparing')) || | |
github.event_name == 'workflow_dispatch' | |
with: | |
name: ${{ steps.artifact-name.outputs.value }} | |
path: ${{ matrix.package }}-* | |
if-no-files-found: error | |
retention-days: 30 |