Skip to content

Commit

Permalink
chore: windows workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfdl committed Jun 17, 2024
1 parent a15fc8e commit 4d57652
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 92 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/build-alpine-x64.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/build-linux-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build for linux-x64

on: workflow_dispatch

env:
CARGO_TERM_COLOR: always
TARGET: x86_64-unknown-linux-gnu
FILENAME: tagoio-relay-linux-x64

jobs:
build:
runs-on: ubuntu-latest
environment: PROD
env:
SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }}
SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }}

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain and components
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ env.TARGET }}

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Create empty .env file
run: touch .env

# Build the modules
- name: Build Binary
run: cargo build --verbose --locked --release

# Run tests
- name: Run tests
run: cargo test --verbose
# Zip the binary
- name: Generate tar.gz
run: |
cd target/release
tar cvf - tagoio-relay | gzip > ../../${{ env.FILENAME }}.tar.gz
# Upload the zip file as an artifact
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.FILENAME }}
path: ./${{ env.FILENAME }}.tar.gz
27 changes: 12 additions & 15 deletions .github/workflows/build-macos-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: workflow_dispatch

env:
CARGO_TERM_COLOR: always
TARGET: aarch64-apple-darwin
FILENAME: tagoio-relay-mac-x64

jobs:
build:
Expand All @@ -19,25 +21,20 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ env.TARGET }}

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Create empty .env file
run: touch .env

# Build the modules
- name: Cargo build
run: cargo build --verbose --release --all-features
- name: Build Binary
run: cargo build --verbose --locked --release

# Run tests
- name: Run tests
Expand Down Expand Up @@ -74,11 +71,11 @@ jobs:
- name: Generate tar.gz
run: |
cd target/release
tar cvf - tagoio-relay | gzip > ../../tagoio-relay-mac-x64.tar.gz
tar cvf - tagoio-relay | gzip > ../../${{ env.FILENAME }}.tar.gz
# Upload the zip file as an artifact
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: tagoio-relay-macos-x64
path: ./tagoio-relay-mac-x64.tar.gz
name: ${{ env.FILENAME }}
path: ./${{ env.FILENAME }}.tar.gz
56 changes: 28 additions & 28 deletions .github/workflows/build-win-x64.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Build for win-x64

on: workflow_dispatch

env:
CARGO_TERM_COLOR: always
TARGET: x86_64-pc-windows-msvc
FILENAME: tagoio-relay-win-x64

jobs:
build:
runs-on: windows-latest
Expand All @@ -12,43 +18,37 @@ jobs:

steps:
# Checkout the code
- name: Checkout the code
uses: actions/checkout@v1
- name: Checkout code
uses: actions/checkout@v4

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# Install Rust and Cross
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
- name: Install Rust toolchain and components
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: rustfmt, clippy
target: ${{ env.TARGET }}

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Create empty .env file
run: touch .env

- name: Install Cross
run: cargo install cross
# Build the modules
- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ env.TARGET }}

# Build the project using Cross
- name: Cross build
run: cross build --target x86_64-pc-windows-msvc --release --all-features
# Run tests
- name: Run tests
run: cargo test --verbose

# Zip the binary
- name: Generate tar.gz
- name: Generate zip
run: |
cd target/x86_64-pc-windows-msvc/release
tar cvf - tagoio-relay | gzip > ../../tagoio-relay-win-x64.tar.gz
cd target/${{ env.TARGET }}/release
Compress-Archive -Path tagoio-relay.exe -DestinationPath ../../${{ env.FILENAME }}.zip
# Upload the zip file as an artifact
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: tagoio-relay-win-x64
path: ./target/x86_64-pc-windows-msvc/tagoio-relay-win-x64.tar.gz
name: ${{ env.FILENAME }}
path: ./${{ env.FILENAME }}.zip

0 comments on commit 4d57652

Please sign in to comment.