Skip to content

Commit

Permalink
ci: remake
Browse files Browse the repository at this point in the history
  • Loading branch information
buxx committed Aug 4, 2024
1 parent 71997b3 commit 357e9cd
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 46 deletions.
7 changes: 7 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Install dependencies'
description: 'Install project OS dependencies (according using Ubuntu)'
runs:
using: "composite"
steps:
- run: sudo apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev libpango1.0-dev libgtk-3-dev
shell: bash
54 changes: 54 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: check-release

on:
push:
branches:
# - 'releases/**' FIXME BS NOW
- '*'

jobs:
check-msys-mingw64:
name: Check build for Windows
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup msys2 dependencies
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-rust mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-pkg-config

- name: Run cargo check
run: cargo check --release

- name: Build
run: cargo build --release

check-linux:
name: Check build for Linux
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Install OS dependencies
run: sudo apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev libpango1.0-dev libgtk-3-dev

- name: Run cargo check
run: cargo check --release

- name: Build
run: cargo build --release
72 changes: 72 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on: [push]

name: Continuous integration

jobs:
check:
name: 🔎 Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: setup
uses: ./.github/actions/setup
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check

test:
name: 🧪 Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: setup
uses: ./.github/actions/setup
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test

fmt:
name: 🔤 Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: setup
uses: ./.github/actions/setup
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: 🛃 Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: setup
uses: ./.github/actions/setup
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
2 changes: 0 additions & 2 deletions .github/workflows/deps.sh

This file was deleted.

112 changes: 90 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,98 @@
name: Release
name: release

on:
release:
types: [created]
push:
tags:
- v*

jobs:
release:
name: release ${{ matrix.target }}
create-release:
name: Create release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz
- target: x86_64-apple-darwin
archive: zip
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/rust-build.action@latest
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
PRE_BUILD: .github/workflows/deps.sh

with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
# draft: false # FIXME
draft: true
# TODO : true if tag contain "rc"
prerelease: false

build-msys-mingw64:
name: Build and package for Windows
needs: create-release
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup msys2 dependencies
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-rust mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-pkg-config

- name: Run cargo check
run: cargo check --release

- name: Build
run: cargo build --release

- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: target/release/trsync.exe # FIXME : zip all executables ?
asset_name: trsync_${{ github.ref_name }}_Win64.zip
asset_content_type: application/octet-stream

build-linux:
name: Build and package for Linux
needs: create-release
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Install OS dependencies
run: sudo apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev libpango1.0-dev libgtk-3-dev

- name: Run cargo check
run: cargo check --release

- name: Build
run: cargo build --release

- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: target/release/trsync # FIXME all in zip ?
asset_name: trsync_${{ github.ref_name }}_Linux
asset_content_type: application/octet-stream
22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

0 comments on commit 357e9cd

Please sign in to comment.