Skip to content
Merged

Hehe #19

Show file tree
Hide file tree
Changes from all commits
Commits
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
169 changes: 64 additions & 105 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ on:

env:
CARGO_TERM_COLOR: always
REGISTRY: frknorg
API_IMAGE_NAME: pony-api
DOCKER_TAG: latest

jobs:
build-agent:
tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Test
run: cargo test --lib

build-node:
needs: [tests]
runs-on: ubuntu-22.04
strategy:
matrix:
Expand All @@ -21,149 +30,99 @@ jobs:
- armv7-unknown-linux-gnueabihf

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
default: true
override: true

- name: Update apt package index
run: sudo apt-get update
targets: ${{ matrix.target }}

- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler

- name: Install zig
run: pip3 install ziglang

- name: Install cargo-zigbuild
run: cargo install --locked cargo-zigbuild
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Install Build Tools
run: |
sudo apt-get update && sudo apt-get install -y protobuf-compiler
pip3 install ziglang
cargo install cargo-zigbuild

- name: Build for ${{ matrix.target }}
run: cargo zigbuild --release --target ${{ matrix.target }} --bin agent --no-default-features
- name: Build Node
run: cargo zigbuild --release --target ${{ matrix.target }} --bin node --features xray,wireguard

- name: Upload artifacts
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: agent-${{ matrix.target }}
path: target/${{ matrix.target }}/release/agent
name: fcore-node-${{ matrix.target }}
path: target/${{ matrix.target }}/release/node

build-api:
runs-on: ubuntu-latest

needs: [tests]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
override: true

- name: Update apt package index
run: sudo apt-get update

- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler

- name: Build
run: cargo build --release --no-default-features --bin api

- name: Upload artifacts
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Test Lib
run: cargo test --lib
- name: Build API
run: cargo build --release --bin api --no-default-features
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: api
name: fcore-api
path: target/release/api

build-auth:
runs-on: ubuntu-latest

needs: [tests]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
override: true

- name: Update apt package index
run: sudo apt-get update

- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler

- name: Build
run: cargo build --release --no-default-features --bin auth

- name: Upload artifacts
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Build Auth
run: cargo build --release --bin auth --no-default-features --features email
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: auth
name: fcore-auth
path: target/release/auth

release:
name: Release
needs: [build-api, build-agent, build-auth]
name: Create Release
needs: [build-api, build-auth, build-node]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download all agent artifacts
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: agent-*
pattern: fcore-*
merge-multiple: false

- name: Download API artifact
uses: actions/download-artifact@v4
with:
name: api
path: artifacts/api

- name: Download Auth artifact
uses: actions/download-artifact@v4
with:
name: auth
path: artifacts/auth

- name: Prepare release files
run: |
mkdir -p release
cp artifacts/agent-x86_64-unknown-linux-gnu/agent release/agent-x86_64
cp artifacts/agent-aarch64-unknown-linux-gnu/agent release/agent-aarch64
cp artifacts/agent-armv7-unknown-linux-gnueabihf/agent release/agent-armv7
cp artifacts/api/api release/api-x86_64
cp artifacts/auth/auth release/auth-x86_64
chmod +x release/*

- name: Release
mkdir -p release_dist
cp artifacts/fcore-node-x86_64-unknown-linux-gnu/node release_dist/node-x86_64
cp artifacts/fcore-node-aarch64-unknown-linux-gnu/node release_dist/node-aarch64
cp artifacts/fcore-node-armv7-unknown-linux-gnueabihf/node release_dist/node-armv7
cp artifacts/fcore-api/api release_dist/api-x86_64
cp artifacts/fcore-auth/auth release_dist/auth-x86_64
chmod +x release_dist/*

- name: Upload to GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release/api-x86_64
release/auth-x86_64
release/agent-x86_64
release/agent-aarch64
release/agent-armv7
release_dist/*
docs/*
README.md
config-agent-example.toml
config-node-example.toml
config-api-example.toml
config-auth-example.toml
env:
Expand Down
Loading
Loading