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 c3ad51a commit a15fc8e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-alpine-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on: workflow_dispatch
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
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/build-macos-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
build:
runs-on: macos-11
runs-on: macOS-latest
environment: PROD
env:
SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
Expand All @@ -30,19 +30,14 @@ jobs:
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
uses: actions-rs/toolchain@v1
with:
toolchain: stable
uses: dtolnay/rust-toolchain@stable

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

# Build the modules
- name: Release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --verbose
- name: Cargo build
run: cargo build --verbose --release --all-features

# Run tests
- name: Run tests
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/build-win-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
runs-on: windows-latest
environment: PROD
env:
SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
Expand All @@ -25,22 +25,30 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
# Install Rust and Cross
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

# Generate the executable
- name: Generate executable
run: ./node_modules/.bin/pkg package.json -t node16-win-x64 --public-packages "*" --no-bytecode --public --compress Brotli
- name: Install Cross
run: cargo install cross

# Zip the executable
- name: Generate zip
run: cd __build__binary__; zip ../tagocore.zip ./tagocore.exe
# Build the project using Cross
- name: Cross build
run: cross build --target x86_64-pc-windows-msvc --release --all-features

# Zip the binary
- name: Generate tar.gz
run: |
cd target/x86_64-pc-windows-msvc/release
tar cvf - tagoio-relay | gzip > ../../tagoio-relay-win-x64.tar.gz
# Upload the zip file as an artifact
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mqttrelay-windows-x64
path: ../tagocore.zip
name: tagoio-relay-win-x64
path: ./target/x86_64-pc-windows-msvc/tagoio-relay-win-x64.tar.gz
11 changes: 4 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Code Quality
on: push
# on: push
on: workflow_dispatch

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -28,20 +29,16 @@ jobs:
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy

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

# Build the modules
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
run: cargo build --verbose

- name: Test
run: cargo test --verbose
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN mkdir -p ${TAGOIO_SOURCE_FOLDER}
WORKDIR ${TAGOIO_SOURCE_FOLDER}
COPY --from=build ${TAGOIO_SOURCE_FOLDER}/target/release/tagoio-mqtt-relay .
COPY --from=build ${TAGOIO_SOURCE_FOLDER}/target/release/tagoio-relay .

RUN /tago-io/tagoio-mqtt-relay init
RUN /tago-io/tagoio-relay init

ENTRYPOINT ["/tago-io/tagoio-mqtt-relay"]
ENTRYPOINT ["/tago-io/tagoio-relay"]
CMD ["start"]

0 comments on commit a15fc8e

Please sign in to comment.