diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d471a84 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,102 @@ +name: "Build, Test and Release" + +on: + workflow_dispatch: + push: + branches: + - "**" + tags: + - "\\d+\\.\\d+\\.\\d+" + pull_request: + branches: + - "main" + +jobs: + test: + name: "Test (rust unit)" + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies on Linux + run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools libssl-dev libsqlite3-0 + + - name: Compile + uses: houseabsolute/actions-rust-cross@v0 + with: + target: "x86_64-unknown-linux-gnu" + command: test + + build: + name: "Build (and Archive) binary" + runs-on: ubuntu-latest + + strategy: + matrix: + platform: + - target: "x86_64-unknown-linux-musl" + suffix: "x86_64" + - target: "aarch64-unknown-linux-musl" + suffix: "aarch64" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt-get update --yes && sudo apt-get install --yes libssl-dev libsqlite3-0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Install musl-tools on Linux + run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools + if: contains(matrix.platform.target, 'musl') + + - name: Compile + uses: houseabsolute/actions-rust-cross@v0 + with: + target: ${{ matrix.platform.target }} + command: build + args: "--release" + strip: true + + - name: Prepare for upload + run: mv "target/${{ matrix.platform.target }}/release/mollysocket" "mollysocket_${{matrix.platform.suffix}}" + + - name: Archive build artifacts + uses: actions/upload-artifact@v3 + with: + name: binary + path: "mollysocket_${{matrix.platform.suffix}}" + + release: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + needs: + - test + - build + steps: + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: binary + path: dist/ + + - name: Semantic-Release + uses: codfish/semantic-release-action@v2 + with: + plugins: |- + [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ "@semantic-release/github", { + "assets": [ + { "path": "dist/*" } + ] + }] + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/image.yml b/.github/workflows/container-image.yml similarity index 86% rename from .github/workflows/image.yml rename to .github/workflows/container-image.yml index 5941970..703b3b7 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/container-image.yml @@ -16,24 +16,19 @@ on: jobs: build: + name: "Build and publish container image" runs-on: ubuntu-latest steps: - name: checkout code uses: actions/checkout@v4 - - name: Generate lowercase repo name for docker registry - id: reponame - uses: ASzc/change-string-case-action@v5 - with: - string: ${{ github.repository }} - - name: Docker meta id: meta uses: docker/metadata-action@v5 with: # list of Docker images to use as base name for tags images: | - ghcr.io/${{ steps.reponame.outputs.lowercase }} + ghcr.io/${{ github.repository }} # generate Docker tags based on the following events/attributes tags: | type=schedule diff --git a/Cargo.toml b/Cargo.toml index 5ca90ad..d8430fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ log = "0.4.17" native-tls = "0.2.11" prost = "0.11" reqwest = { version = "0.11.18", features = ["json"]} +openssl = { version = "0.10.57", features = ["vendored"] } serde = { version = "1.0.163", features = ["derive"]} tokio-tungstenite = { version = "0.18.0", features = ["native-tls"] } tokio = { version = "1", features = ["macros", "rt-multi-thread"] } diff --git a/Containerfile b/Containerfile index 51f9fee..872a622 100644 --- a/Containerfile +++ b/Containerfile @@ -9,7 +9,7 @@ FROM docker.io/debian:bookworm as runtime WORKDIR app RUN apt update && \ - apt install -y libssl3 libsqlite3-0 + apt install -y libssl3 libsqlite3-0 ca-certificates COPY --from=builder /app/target/release/mollysocket /usr/local/bin/ diff --git a/README.md b/README.md index 0145624..fb81b3c 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,7 @@ MollySocket receives the credentials for a linked device and does not receive an AGPLv3: see [LICENSE.txt](./LICENSE.txt). ## Disclaimer -This project is NOT sponsored by or affiliated to Signal Messenger, Signal Foundation or the Molly project (*). +This project is NOT sponsored by or affiliated to Signal Messenger or Signal Foundation. The software is produced independently of Signal and carries no guarantee about quality, security or anything else. Use at your own risk. -\* But they are ok with name "MollySocket"