-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from bpmb82/bb/feature/github_actions
Bb/feature/GitHub actions
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.runner }} | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- name: linux-amd64 | ||
runner: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
artifact_name: ${{ github.event.repository.name }}-linux-amd64.tar.gz | ||
asset_extension: "" | ||
compression_type: tar | ||
- name: win-amd64 | ||
runner: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
artifact_name: ${{ github.event.repository.name }}-windows-amd64.zip | ||
asset_extension: ".exe" | ||
compression_type: zip | ||
- name: macos-amd64 | ||
runner: macos-latest | ||
target: x86_64-apple-darwin | ||
artifact_name: ${{ github.event.repository.name }}-macos-amd64.tar.gz | ||
asset_extension: "" | ||
compression_type: tar | ||
- name: macos-arm64 | ||
runner: macos-latest | ||
target: aarch64-apple-darwin | ||
artifact_name: ${{ github.event.repository.name }}-macos-aarch64.tar.gz | ||
asset_extension: "" | ||
compression_type: tar | ||
|
||
steps: | ||
|
||
- name: Get tag | ||
id: tag | ||
uses: devops-actions/[email protected] | ||
|
||
- name: Install dependencies if target is Linux x86_64 | ||
shell: bash | ||
run: | | ||
sudo apt update && sudo apt install -y gcc curl libasound2-dev libasound2 openssl pkg-config | ||
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: "${{ matrix.target }}" | ||
|
||
- name: Setup Cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build Binary | ||
run: cargo build --verbose --release --target ${{ matrix.target }} | ||
|
||
- name: Archive Release | ||
uses: thedoctor0/[email protected] | ||
with: | ||
type: ${{ matrix.compression_type }} | ||
directory: target/${{ matrix.target }}/release/ | ||
path: ${{ github.event.repository.name }}${{ matrix.asset_extension }} | ||
filename: '${{ matrix.artifact_name }}' | ||
|
||
- name: Create Github Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: ${{ steps.tag.outputs.tag }} | ||
artifacts: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | ||
replacesArtifacts: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
allowUpdates: true | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM debian:bookworm-slim | ||
|
||
# Install Rust system-wide | ||
ENV RUSTUP_HOME=/opt/rust | ||
ENV CARGO_HOME=/opt/rust | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
|
||
RUN apt update && apt install -y gcc curl libasound2-dev libasound2 openssl pkg-config && \ | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path | ||
ENV PATH="/opt/rust/bin:${PATH}" | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
WORKDIR /mqtt2midi | ||
|
||
CMD [ "/entrypoint.sh" ] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
docker build --load -t mqtt2midi:latest . | ||
|
||
docker run -ti -v $PWD:/mqtt2midi -w /mqtt2midi --env USERID=$(id -u ${USER}) --env DIR=$PWD mqtt2midi:latest |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
cargo build --release --target-dir /mqtt2midi/target | ||
echo "Release was built to $DIR/target/" | ||
chown -R ${USERID}:${USERID} /mqtt2midi/target |