-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9a5d58
commit cf6ad0e
Showing
6 changed files
with
184 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name: Tpi tool CI | ||
name: Tpi Validation Pipeline | ||
on: [push] | ||
jobs: | ||
clippy_check: | ||
|
||
cargo-clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -10,99 +11,51 @@ jobs: | |
with: | ||
token: '${{ secrets.GITHUB_TOKEN }}' | ||
args: '--all-features' | ||
cargo-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
profile: minimal | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
|
||
cargo-deny: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: EmbarkStudios/cargo-deny-action@v1 | ||
with: | ||
command: check bans licenses sources | ||
target-pipeline: | ||
name: "${{ matrix.target }}" | ||
strategy: | ||
matrix: | ||
target: | ||
- aarch64-unknown-linux-gnu | ||
- aarch64-apple-darwin | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
- x86_64-unknown-linux-gnu | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-22.04 | ||
- target: aarch64-unknown-linux-gnu | ||
os: ubuntu-22.04 | ||
cross: true | ||
- target: aarch64-apple-darwin | ||
os: macos-13 | ||
- target: x86_64-apple-darwin | ||
os: macos-13 | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-2022 | ||
runs-on: '${{ matrix.os }}' | ||
|
||
cargo-test: | ||
runs-on: ubuntu-latest | ||
needs: cargo-deny | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
profile: minimal | ||
target: '${{ matrix.target }}' | ||
- name: build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: '--release --locked --target=${{ matrix.target }}' | ||
use-cross: ${{ matrix.cross }} | ||
- name: archive | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
name: 'build output' | ||
path: | | ||
# workaround to prevent a common ancestor in the files, | ||
# this way we can perserve the folder structure. | ||
.github/workflows/build.yml | ||
target/${{ matrix.target }}/release/tpi | ||
target/${{ matrix.target }}/release/tpi.exe | ||
target/${{ matrix.target }}/release/build/*/out/PKGBUILD | ||
command: test | ||
- name: Extract version from Cargo.toml | ||
id: extract_version | ||
run: | | ||
VERSION=$(grep '^version = ' Cargo.toml | sed -E 's/version = "(.*)"/\1/') | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
archive: | ||
name: ${{ matrix.name }} packager | ||
runs-on: ubuntu-latest | ||
needs: target-pipeline | ||
strategy: | ||
matrix: | ||
name: | ||
- debian | ||
- arch | ||
- windows | ||
- macos | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: 'build output' | ||
- name: running archiver | ||
run: scripts/ci/package.sh ${{ matrix.name }} | ||
- name: archive packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: '${{ matrix.name }} packages' | ||
path: | | ||
target/debian/* | ||
target/arch/* | ||
target/win/* | ||
target/apple/* | ||
- name: Check if tag exists | ||
id: check_tag | ||
run: | | ||
if git rev-parse --verify v${VERSION} >/dev/null 2>&1; then | ||
echo "TAG_EXISTS=true" >> $GITHUB_ENV | ||
else | ||
echo "TAG_EXISTS=false" >> $GITHUB_ENV | ||
fi | ||
- name: Create new tag | ||
if: ${{ env.TAG_EXISTS == 'false' }} | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "[email protected]" | ||
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" | ||
git push origin "v${{ env.VERSION }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Release Pipeline | ||
on: | ||
push: | ||
branches: | ||
- 'feature/ci' | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
jobs: | ||
|
||
build-pipeline: | ||
name: "Build ${{ matrix.target }}" | ||
strategy: | ||
matrix: | ||
target: | ||
- aarch64-unknown-linux-gnu | ||
- aarch64-apple-darwin | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
- x86_64-unknown-linux-gnu | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-22.04 | ||
- target: aarch64-unknown-linux-gnu | ||
os: ubuntu-22.04 | ||
cross: true | ||
- target: aarch64-apple-darwin | ||
os: macos-13 | ||
- target: x86_64-apple-darwin | ||
os: macos-13 | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-2022 | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
profile: minimal | ||
target: ${{ matrix.target }} | ||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --locked --target=${{ matrix.target }} | ||
use-cross: ${{ matrix.cross }} | ||
|
||
- name: Create Unix Archive | ||
if: ${{ !contains(matrix.target, 'windows') }} | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
srcdir: $PWD | ||
pkgdir: /tmp/pkg | ||
run: | | ||
mkdir -p $pkgdir | ||
. scripts/ci/install | ||
tar -czf tpi-${{ matrix.target }}.tar.gz $pkgdir | ||
- name: Upload Archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: | | ||
tpi-${{ matrix.target }}.tar.gz | ||
target/${{ matrix.target }}/release/tpi.exe | ||
debian-packages: | ||
runs-on: ubuntu-latest | ||
needs: build-pipeline | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: x86_64-unknown-linux-gnu | ||
- name: Extract tar.gz file | ||
run: | | ||
mkdir tpi-x86_64-unknown-linux-gnu | ||
tar -xf tpi-x86_64-unknown-linux-gnu.tar.gz -C tpi-x86_64-unknown-linux-gnu | ||
rm -rf tpi-x86_64-unknown-linux-gnu.tar.gz | ||
- name: Create DEBIAN package | ||
run: scripts/ci/create_debian_control.sh Cargo.toml amd64 tpi-x86_64-unknown-linux-gnu | ||
- run: dpkg-deb --build tpi-x86_64-unknown-linux-gnu | ||
- name: Upload Archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: x86_64-unknown-linux-gnu-deb | ||
path: | | ||
tpi-x86_64-unknown-linux-gnu.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name = "tpi" | |
version = "1.0.6" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
authors = ["Sven Rademakers <[email protected]>", "Ruslan Akbashev <[email protected]>"] | ||
authors = ["Sven Rademakers <[email protected]>"] | ||
description = "Official Turing-Pi2 CLI tool" | ||
homepage = "https://turingpi.com/" | ||
repository = "https://github.com/turing-machines/tpi" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright 2023 Turing Machines | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
#!/bin/bash | ||
toml_file=${1} | ||
arch=${2} | ||
output_dir=${3:-$(pwd)} | ||
|
||
if [ -z "$2" ]; then | ||
echo "missing architecture argument" >&2 | ||
exit -1 | ||
fi | ||
|
||
if [ ! -f "${toml_file}" ]; then | ||
echo "provided toml file: ${toml_file}, does not exist" >&2 | ||
exit -1 | ||
fi | ||
|
||
PACKAGE_NAME=$(grep '^name =' ${toml_file} | sed 's/name = "\(.*\)"/\1/') | ||
VERSION=$(grep '^version =' ${toml_file} | sed 's/version = "\(.*\)"/\1/') | ||
MAINTAINER=$(grep '^authors =' ${toml_file} | sed 's/authors = \[\s*"\(.*\)\s*"\]/\1/') | ||
DESCRIPTION=$(grep '^description =' ${toml_file} | sed 's/description = "\(.*\)"/\1/') | ||
|
||
mkdir -p ${output_dir}/DEBIAN/ | ||
cat <<EOL > "${output_dir}/DEBIAN/control" | ||
Package: $PACKAGE_NAME | ||
Version: $VERSION | ||
Section: base | ||
Priority: optional | ||
Architecture: ${arch} | ||
Maintainer: $MAINTAINER | ||
Description: $DESCRIPTION | ||
EOL | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
install -Dm 755 ${srcdir}/target/${TARGET}/release/tpi ${pkgdir}/usr/bin/tpi | ||
install -Dm 644 ${srcdir}/LICENSE ${pkgdir}/usr/share/doc/tpi/copyright | ||
install -Dm 644 ${srcdir}/README.md ${pkgdir}/usr/share/doc/tpi/README.md | ||
|
This file was deleted.
Oops, something went wrong.