Skip to content

Commit

Permalink
Update package_reusable.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Radu Marias <[email protected]>
  • Loading branch information
radumarias authored Dec 17, 2024
1 parent 4609612 commit 892e2e8
Showing 1 changed file with 61 additions and 74 deletions.
135 changes: 61 additions & 74 deletions .github/workflows/package_reusable.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: '_build-and-tests'
name: '_package'
on:
workflow_call:

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0 # TODO: remove this when we cache the builds
inputs:
upload_artifacts:
description: 'If we should upload artifacts'
type: boolean
required: true
version:
description: 'The current value in version file (type: string)'
type: string
required: true

jobs:
tests:
name: build and tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: true
aur_build:
name: build AUR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -29,73 +30,59 @@ jobs:
cargo install cargo-aur
cargo install cargo-generate-rpm
- name: build
run: |
cargo build --all-targets --all-features
cargo build --release --all-targets --all-features
- name: fmt check
run: cargo fmt --all -- --check

- name: check
run: cargo check --all

- name: clippy
run: |
cargo clippy --all-targets --release -- \
-A clippy::similar_names \
-A clippy::too_many_arguments \
-A clippy::significant_drop_tightening \
-A clippy::redundant_closure \
-A clippy::missing_errors_doc \
-A clippy::type_complexity
shell: bash

- name: doc
run: cargo doc --workspace --all-features --no-deps

- name: tests
if: matrix.os != 'windows-latest'
run: cargo test --release --all --all-features

- name: test package
if: matrix.os == 'ubuntu-latest'
- name: run cargo aur and generate-rpm
run: |
cargo aur
cargo generate-rpm
- name: java-bridge build
run: |
cd java-bridge
cargo build --all-targets --all-features
cargo build --release --all-targets --all-features
- name: java-bridge fmt check
run: |
cd java-bridge
cargo fmt --all -- --check
- name: upload PKGBUILD artifact
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: PKGBUILD
path: ./target/cargo-aur/PKGBUILD

- name: java-bridge check
run: |
cd java-bridge
cargo check --all
- name: upload ${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz artifact
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz
path: ./target/cargo-aur/${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz

docker:
name: docker
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
attestations: write
env:
# Hostname of your registry
REGISTRY: docker.io
REGISTRY_USER: xorio42
# Image repository, without hostname and tag
IMAGE_NAME: ${{ github.event.repository.name }}
IMAGE_TAG: latest
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
steps:
- uses: actions/checkout@v4

- name: java-bridge clippy
run: |
cargo clippy --all-targets --release -- \
-A clippy::similar_names \
-A clippy::too_many_arguments \
-A clippy::significant_drop_tightening \
-A clippy::redundant_closure \
-A clippy::missing_errors_doc \
-A clippy::type_complexity
shell: bash
- name: log in to Docker Hub
if: inputs.upload_artifacts
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: java-bridge doc
run: cargo doc --workspace --all-features --no-deps
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: java-bridge tests
if: matrix.os != 'windows-latest'
run: |
cd java-bridge
cargo test --release --all --all-features
- name: build push = ${{ inputs.upload_artifacts }}
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
push: ${{ inputs.upload_artifacts }}
tags: ${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
sbom: true
provenance: true

0 comments on commit 892e2e8

Please sign in to comment.