mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-06-26 10:54:29 +02:00
Improves build using matrix
This commit is contained in:
parent
1f8362c5d0
commit
d86e08647a
2 changed files with 29 additions and 15 deletions
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
|
@ -4,7 +4,17 @@ on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build TaskChampion Sync-Server
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- tag: amd64-musl
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
test: false
|
||||||
|
- tag: amd64-glibc
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
test: true
|
||||||
|
name: Build TaskChampion Sync-Server ${{ matrix.target.tag }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -13,35 +23,39 @@ jobs:
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: 1.77
|
toolchain: 1.77
|
||||||
|
targets: ${{ matrix.target.target }}
|
||||||
- name: Test
|
- name: Test
|
||||||
|
if: ${{ matrix.target.test }}
|
||||||
run: cargo test
|
run: cargo test
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --locked
|
run: |
|
||||||
|
[ "${{ matrix.target.target }}" == "x86_64-unknown-linux-musl" ] && sudo apt update && sudo apt -y install musl-tools
|
||||||
|
cargo build --target ${{ matrix.target.target }} --release --locked
|
||||||
- name: Package current compilation
|
- name: Package current compilation
|
||||||
id: package-current
|
id: package-current
|
||||||
run: |
|
run: |
|
||||||
install -Dm755 "target/release/taskchampion-sync-server" "taskchampion-sync-server-${GITHUB_REF##*/}-${GITHUB_SHA}/taskchampion-sync-server"
|
install -Dm755 "target/${{ matrix.target.target }}/release/taskchampion-sync-server" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}-${GITHUB_SHA}/taskchampion-sync-server"
|
||||||
install -Dm644 "README.md" "taskchampion-sync-server-${GITHUB_REF##*/}-${GITHUB_SHA}/README.md"
|
install -Dm644 "README.md" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}-${GITHUB_SHA}/README.md"
|
||||||
install -Dm644 "LICENSE" "taskchampion-sync-server-${GITHUB_REF##*/}-${GITHUB_SHA}/LICENSE"
|
install -Dm644 "LICENSE" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}-${GITHUB_SHA}/LICENSE"
|
||||||
echo "version=${GITHUB_REF##*/}-${GITHUB_SHA}" >> $GITHUB_OUTPUT
|
echo "version=${GITHUB_REF##*/}-${GITHUB_SHA}" >> $GITHUB_OUTPUT
|
||||||
- name: Archive current compilation
|
- name: Archive current compilation
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: "taskchampion-sync-server-${{ steps.package-current.outputs.version }}"
|
name: "taskchampion-sync-server-${{ matrix.target.tag }}-${{ steps.package-current.outputs.version }}"
|
||||||
path: "taskchampion-sync-server-${{ steps.package-current.outputs.version }}/"
|
path: "taskchampion-sync-server-${{ matrix.target.tag }}-${{ steps.package-current.outputs.version }}/"
|
||||||
- name: Package tagged compilation
|
- name: Package tagged compilation
|
||||||
id: package
|
id: package
|
||||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
|
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
|
||||||
run: |
|
run: |
|
||||||
install -Dm755 "target/release/taskchampion-sync-server" "taskchampion-sync-server-${GITHUB_REF##*/}/taskchampion-sync-server"
|
install -Dm755 "target/${{ matrix.target.target }}/release/taskchampion-sync-server" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}/taskchampion-sync-server"
|
||||||
install -Dm644 "README.md" "taskchampion-sync-server-${GITHUB_REF##*/}/README.md"
|
install -Dm644 "README.md" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}/README.md"
|
||||||
install -Dm644 "LICENSE" "taskchampion-sync-server-${GITHUB_REF##*/}/LICENSE"
|
install -Dm644 "LICENSE" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}/LICENSE"
|
||||||
tar cvJf "taskchampion-sync-server-${GITHUB_REF##*/}.tar.xz" "taskchampion-sync-server-${GITHUB_REF##*/}"
|
tar cvJf "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}.tar.xz" "taskchampion-sync-server-${{ matrix.target.tag }}-${GITHUB_REF##*/}"
|
||||||
echo "version=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
|
echo "version=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
|
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
|
||||||
with:
|
with:
|
||||||
files: "taskchampion-sync-server-${{ steps.package.outputs.version }}.tar.xz"
|
files: "taskchampion-sync-server-${{ matrix.target.tag }}-${{ steps.package.outputs.version }}.tar.xz"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to ghcr.io
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue