Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Workflow refactor #614

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ba59dfc
test optimized builds
obalaribe Jul 10, 2024
af267fd
test optimized builds
obalaribe Jul 10, 2024
d8fde04
test optimized builds
obalaribe Jul 10, 2024
2be6b53
test optimized builds
obalaribe Jul 10, 2024
32fa64e
test optimized builds
obalaribe Jul 10, 2024
1ed03a7
test optimized builds
obalaribe Jul 10, 2024
7da04d0
test infra repo dispatch
obalaribe Jul 10, 2024
fc33e07
test infra repo dispatch
obalaribe Jul 10, 2024
59dea7a
test infra repo dispatch
obalaribe Jul 10, 2024
99fbbb4
test infra repo dispatch
obalaribe Jul 10, 2024
eac91f7
test infra repo dispatch
obalaribe Jul 10, 2024
49e1ef7
test infra repo dispatch
obalaribe Jul 10, 2024
a2acdbb
test infra repo dispatch
obalaribe Jul 10, 2024
eb69b9a
test infra repo dispatch
obalaribe Jul 10, 2024
08b297d
test infra repo dispatch
obalaribe Jul 10, 2024
ca8b6d9
test matrix builds
obalaribe Jul 10, 2024
a5141a3
test matrix builds
obalaribe Jul 10, 2024
149acd4
test matrix builds
obalaribe Jul 10, 2024
fba7fd2
test matrix builds
obalaribe Jul 10, 2024
c39b2d3
test matrix builds
obalaribe Jul 10, 2024
b0ac8ba
test matrix builds
obalaribe Jul 10, 2024
843bd38
test matrix builds
obalaribe Jul 10, 2024
6c4b2f7
test matrix builds
obalaribe Jul 10, 2024
cbe278d
test matrix builds
obalaribe Jul 10, 2024
9f038f8
update step titles
obalaribe Jul 15, 2024
38a6013
update windows build target
obrienalaribe Jul 10, 2024
cd50a09
update windows build
obrienalaribe Jul 10, 2024
c14ae87
update cargo lock
obalaribe Jul 15, 2024
d0a0451
Publish binary artifacts
obrienalaribe Jul 10, 2024
3259e17
rebase
obalaribe Jul 15, 2024
951e514
update cargo lock
obalaribe Jul 15, 2024
8183f7f
Include docker build and all workspaces
obalaribe Jul 15, 2024
a5f3a8c
Add binary name to deploy.yml
obrienalaribe Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Optimize Build
on:
push:
branches:
- '**'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
workspace: avail-light-bootstrap
binary: avail-light-bootstrap
rust_target: x86_64-unknown-linux-gnu
output_name: avail-light-bootstrap-linux-amd64
extra_setup: |
rustup target add x86_64-unknown-linux-gnu

- os: ubuntu-20.04
workspace: avail-light-relay
binary: avail-light-relay
rust_target: x86_64-unknown-linux-gnu
output_name: avail-light-relay-linux-amd64
extra_setup: |
rustup target add x86_64-unknown-linux-gnu

- os: ubuntu-20.04
workspace: avail-light-client
binary: avail-light
rust_target: x86_64-unknown-linux-gnu
output_name: avail-light-linux-amd64
extra_setup: |
rustup target add x86_64-unknown-linux-gnu

- os: ubuntu-20.04
workspace: avail-light-client
binary: avail-light
rust_target: aarch64-unknown-linux-gnu
output_name: avail-light-linux-arm64
extra_setup: |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
export BINDGEN_EXTRA_CLANG_ARGS='--sysroot /usr/aarch64-linux-gnu'
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc

- os: macos-14
workspace: avail-light-client
binary: avail-light
rust_target: aarch64-apple-darwin
output_name: avail-light-apple-arm64
extra_setup: |
rustup target add aarch64-apple-darwin

- os: macos-13
workspace: avail-light-client
binary: avail-light
rust_target: x86_64-apple-darwin
output_name: avail-light-apple-x86_64
extra_setup: |
rustup target add x86_64-apple-darwin

- os: windows-latest
workspace: avail-light-client
binary: avail-light
rust_target: x86_64-pc-windows-msvc
output_name: avail-light-x86_64-pc-windows-msvc.exe
extra_setup: |
Invoke-WebRequest -Uri https://win.rustup.rs -OutFile rustup-init.exe
.\rustup-init.exe -y --default-toolchain stable
$env:Path += ";$env:USERPROFILE\.cargo\bin"
rustup target add x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v4
- name: Install cargo and setup
if: runner.os != 'Windows'
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y librust-openssl-dev build-essential protobuf-compiler musl-tools clang libc6-dev libc6-dev-arm64-cross libssl-dev pkg-config
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"

- name: Build on linux/mac ${{ matrix.output_name }}
if: runner.os != 'Windows'
shell: bash
run: |
${{ matrix.extra_setup }}
cargo build --profile maxperf --target=${{ matrix.rust_target }} -p ${{ matrix.workspace }}
mv target/${{ matrix.rust_target }}/maxperf/${{ matrix.binary }} target/${{ matrix.rust_target }}/maxperf/${{ matrix.output_name }}
pushd target/${{ matrix.rust_target }}/maxperf/
tar czf ${{ matrix.output_name }}.tar.gz ${{ matrix.output_name }}

- name: Build on windows ${{ matrix.output_name }}
if: runner.os == 'Windows'
shell: pwsh
run: |
${{ matrix.extra_setup }}
cargo build --profile maxperf --target=${{ matrix.rust_target }} -p ${{ matrix.workspace }}
Move-Item -Path "target\${{ matrix.rust_target }}\maxperf\${{ matrix.binary }}.exe" -Destination "target\${{ matrix.rust_target }}\maxperf\${{ matrix.output_name }}"
Push-Location -Path "target\${{ matrix.rust_target }}\maxperf\"
Compress-Archive -Path "${{ matrix.output_name }}" -DestinationPath "${{ matrix.output_name }}.tar.gz"

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output_name }}
path: target/${{ matrix.rust_target }}/maxperf/${{ matrix.output_name }}.tar.gz

binary_publish:
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v4
with:
path: binaries
pattern: avail-light*
merge-multiple: true

- name: publish binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT_TOKEN }}
file: /home/runner/work/avail-light/avail-light/binaries/avail-light*
release_name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
overwrite: true
file_glob: true

trigger_deploy_workflow:
needs: [binary_publish]
runs-on: ubuntu-20.04
steps:
- name: Trigger repository_dispatch for release
shell: bash
run: |
curl -s -o /dev/null -w "%{http_code}" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
https://api.github.com/repos/availproject/avail-light-infra/dispatches \
-d '{"event_type": "binary_release", "client_payload": {"avail_light_version": "${{ github.ref_name }}"}}'

- name: Trigger repository dispatch for crawler
if: false
shell: bash
run: |
curl -s -o /dev/null -w "%{http_code}" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
${{ secrets.CRAWLER_BUILD_URL}} \
-d "{\"event_type\": \"lc_crawler_build\", \"client_payload\": {\"tag\": \"${{ github.ref_name }}\"}}" \
| grep -q "204"

# build avail image and publish to dockerhub
docker_build_push:
needs: [binary_publish]
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile.release
platforms: linux/amd64
push: true
tags: availj/avail-light:${{ github.ref_name }}
build-args: |
AVAIL_TAG=${{ github.ref_name }}
1 change: 1 addition & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ jobs:
https://api.github.com/repos/availproject/avail-light-infra/dispatches \
-d '{"event_type":"binary_release","client_payload":{"avail_light_version":"${{ env.TAG_NAME }}"}}'


# build avail image and publish to dockerhub
docker_build_push:
needs: [binary_publish]
Expand Down
Loading