Skip to content

Commit

Permalink
Update CI workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
apognu committed Oct 29, 2023
1 parent f326ba2 commit 78047e2
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 94 deletions.
58 changes: 31 additions & 27 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,54 @@ name: Development build
on:
push:
branches:
- 'dev/*'
- "dev/*"

jobs:
clippy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: clippy
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Lint
run: |
cargo clippy
cargo clippy --release
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: |
cargo test
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
matrix:
arch:
- { name: 'x86_64', os: 'ubuntu-latest', target: 'x86_64-unknown-linux-gnu', cross: false }
- { name: 'i686', os: 'ubuntu-latest', target: 'i686-unknown-linux-gnu', cross: true }
- { name: 'armv7h', os: 'ubuntu-latest', target: 'armv7-unknown-linux-gnueabihf', cross: true }
- { name: 'aarch64', os: 'ubuntu-latest', target: 'aarch64-unknown-linux-gnu', cross: true }
- {
name: "x86_64",
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
runs-on: ${{ matrix.arch.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: target/
key: cargo-cache-${{ matrix.arch.target }}
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
toolchain: stable
shared-key: cargo-cache-${{ matrix.arch.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.arch.target }}
use-cross: ${{ matrix.arch.cross }}
run: |
cargo build --release --target=${{ matrix.arch.target }}
- name: Rename artifact
run: mv target/${{ matrix.arch.target }}/release/tuigreet target/${{ matrix.arch.target }}/release/tuigreet-dev-${{ matrix.arch.name }}
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: tuigreet-dev-${{ matrix.arch.name }}
path: target/${{ matrix.arch.target }}/release/tuigreet-dev-${{ matrix.arch.name }}
74 changes: 38 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,52 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: clippy
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Lint
run: |
cargo clippy
cargo clippy --release
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: |
cargo test
build:
strategy:
matrix:
arch:
- { name: 'x86_64', os: 'ubuntu-latest', target: 'x86_64-unknown-linux-gnu', cross: false }
- { name: 'i686', os: 'ubuntu-latest', target: 'i686-unknown-linux-gnu', cross: true }
- { name: 'armv7h', os: 'ubuntu-latest', target: 'armv7-unknown-linux-gnueabihf', cross: true }
- { name: 'aarch64', os: 'ubuntu-latest', target: 'aarch64-unknown-linux-gnu', cross: true }
- {
name: "x86_64",
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
runs-on: ${{ matrix.arch.os }}
steps:
- name: Get the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
path: target/
key: cargo-cache-${{ matrix.arch.target }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
shared-key: cargo-cache-${{ matrix.arch.target }}
- run: rm -rf .git/
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.arch.target }}
use-cross: ${{ matrix.arch.cross }}
run: |
cargo build --release --target=${{ matrix.arch.target }}
- name: Rename artifact
run: mv target/${{ matrix.arch.target }}/release/tuigreet target/${{ matrix.arch.target }}/release/tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }}
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }}
path: target/${{ matrix.arch.target }}/release/tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }}
Expand All @@ -78,23 +78,25 @@ jobs:
strategy:
matrix:
arch:
- { name: 'x86_64', os: 'ubuntu-latest', target: 'x86_64-unknown-linux-gnu', cross: false }
- { name: 'i686', os: 'ubuntu-latest', target: 'i686-unknown-linux-gnu', cross: true }
- { name: 'armv7h', os: 'ubuntu-latest', target: 'armv7-unknown-linux-gnueabihf', cross: true }
- { name: 'aarch64', os: 'ubuntu-latest', target: 'aarch64-unknown-linux-gnu', cross: true }
- {
name: "x86_64",
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
runs-on: ubuntu-latest
needs: release
steps:
- name: Get the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: target/out
- name: Get Release
id: get_release
uses: bruceadams/get-release@v1.2.0
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
Expand Down
66 changes: 35 additions & 31 deletions .github/workflows/tip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,64 @@ on:

jobs:
clippy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: clippy
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Lint
run: |
cargo clippy
cargo clippy --release
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: |
cargo test
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
matrix:
arch:
- { name: 'x86_64', os: 'ubuntu-latest', target: 'x86_64-unknown-linux-gnu', cross: false }
- { name: 'i686', os: 'ubuntu-latest', target: 'i686-unknown-linux-gnu', cross: true }
- { name: 'armv7h', os: 'ubuntu-latest', target: 'armv7-unknown-linux-gnueabihf', cross: true }
- { name: 'aarch64', os: 'ubuntu-latest', target: 'aarch64-unknown-linux-gnu', cross: true }
- {
name: "x86_64",
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
runs-on: ${{ matrix.arch.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: target/
key: cargo-cache-${{ matrix.arch.target }}
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
toolchain: stable
shared-key: cargo-cache-${{ matrix.arch.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=${{ matrix.arch.target }}
use-cross: ${{ matrix.arch.cross }}
run: |
cargo build --release --target=${{ matrix.arch.target }}
- name: Rename artifact
run: mv target/${{ matrix.arch.target }}/release/tuigreet target/${{ matrix.arch.target }}/release/tuigreet-tip-${{ matrix.arch.name }}
run: mv target/${{ matrix.arch.target }}/release/tuigreet target/${{ matrix.arch.target }}/release/tuigreet-dev-${{ matrix.arch.name }}
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: tuigreet-tip-${{ matrix.arch.name }}
path: target/${{ matrix.arch.target }}/release/tuigreet-tip-${{ matrix.arch.name }}
name: tuigreet-dev-${{ matrix.arch.name }}
path: target/${{ matrix.arch.target }}/release/tuigreet-dev-${{ matrix.arch.name }}

package:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: target/out
- name: Create release
uses: eine/tip@tip
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: target/out/*/*
Expand Down

0 comments on commit 78047e2

Please sign in to comment.