Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to PyPi on PR merge #7

Merged
merged 17 commits into from
Mar 4, 2024
Merged
35 changes: 0 additions & 35 deletions .github/workflows/build.yaml

This file was deleted.

101 changes: 70 additions & 31 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,80 @@
name: "Deploy"
name: Release

on:
pull_request:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
workflow_dispatch:

jobs:
build_linux:
uses: ./.github/workflows/workflow-build-backend.yaml
with:
target: ubuntu-latest

build_windows:
uses: ./.github/workflows/workflow-build-backend.yaml
with:
target: windows-latest

build_macos:
uses: ./.github/workflows/workflow-build-backend.yaml
with:
target: macos-latest

upload:
needs: [build_linux, build_windows, build_macos]
runs-on: ubuntu-latest
release:
name: Release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
# linux

- release_for: linux-x86_64-gnu
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bin: aqora
name: aqora-linux-x86_64-gnu.tar.gz

# windows

- release_for: windows-x86_64-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
bin: aqora.exe
name: aqora-windows-x86_64-msvc.zip

- release_for: windows-x86_64-gnu
os: windows-latest
target: x86_64-pc-windows-gnu
bin: aqora.exe
name: aqora-windows-x86_64-gnu.zip

# macos

- release_for: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
bin: aqora
name: aqora-darwin-x86_64.tar.gz

- release_for: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
bin: aqora
name: aqora-darwin-aarch64.tar.gz

runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v5
- name: Checkout
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
python-version: '3.10'
cache: 'pip'
- run: pip install twine
- uses: actions/download-artifact@v4
target: ${{ matrix.platform.target }}
args: "--release"
strip: true
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
path: dist
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R dist

draft: true
files: "aqora*"
if: startsWith( github.ref, 'refs/tags/v' )
10 changes: 7 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: "Test"
name: Test

on:
workflow_call:
pull_request:
push:
branches:
- main

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
Expand All @@ -17,6 +20,7 @@ jobs:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo clippy -- -D warnings
- run: cargo test
Expand Down
Loading