Skip to content

Commit

Permalink
Hello world!
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Jun 26, 2024
0 parents commit 87f2805
Show file tree
Hide file tree
Showing 29 changed files with 3,690 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: cargo
# Look for `Cargo.toml` and `Cargo.lock` in the root directory
directory: "/"
# Check for updates every Monday
schedule:
interval: weekly
open-pull-requests-limit: 2
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: ci

on:
pull_request:
push:
branches:
- main

jobs:
check:
name: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@V27
with:
extra_nix_config: access-tokens = github.com=${{ github.token }}

- name: Check nix formatting
run: nix fmt -- -c .

- name: Set up cachix
uses: cachix/cachix-action@v15
with:
name: nix-community

- name: Build with nix and run checks
run: |
nix flake check
check-win:
name: "check windows"
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release

ci:
runs-on: ubuntu-latest
needs: [check, check-win]
steps:
- name: Aggregate of lint, and all tests
run: echo "ci passed"
281 changes: 281 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
name: Publish
on:
push:
tags:
- 'v*'
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
build:
- aarch64
- aarch64-musl
# - i686
- amd64-musl
- amd64
include:
- build: aarch64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
features: "--no-default-features --features rustls"
- build: aarch64-musl
os: ubuntu-latest
target: aarch64-unknown-linux-musl
use-cross: true
features: "--no-default-features --features rustls"
# - build: i686
# os: ubuntu-latest
# target: i686-unknown-linux-gnu
# use-cross: true
# features: "--no-default-features --features rustls"
- build: amd64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: false
features: ""
- build: amd64-musl
os: ubuntu-latest
target: x86_64-unknown-linux-musl
use-cross: true
features: "--no-default-features --features rustls"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0

- name: Install prerequisites
shell: bash
run: |
sudo apt-get -y update
case ${{ matrix.target }} in
arm-unknown-linux-gnueabihf) sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
aarch64-unknown-linux-musl) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
sudo apt-get -y install libssl-dev openssl pkg-config
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
if [[ $PROJECT_VERSION == *-pre ]]; then
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
else
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
default: true

- name: Show version information (Rust, cargo, GCC)
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: ${{ matrix.features }} --release --target=${{ matrix.target }}

- name: Strip debug information from executable
id: strip
shell: bash
run: |
# Figure out what strip tool to use if any
STRIP="strip"
case ${{ matrix.target }} in
arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;;
aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;;
aarch64-unknown-linux-musl) STRIP="aarch64-linux-gnu-strip" ;;
*-pc-windows-msvc) STRIP="" ;;
esac;
# Setup paths
BIN_DIR="_cicd/stripped-release-bin/"
mkdir -p "${BIN_DIR}"
BIN_NAME="${{ env.PROJECT_NAME }}"
BIN_PATH="${BIN_DIR}/${BIN_NAME}_${{ matrix.build }}-${{ env.VERSION_SUFFIX }}"
# Copy the release build binary to the result location
cp "target/${{ matrix.target }}/release/${BIN_NAME}" "${BIN_PATH}"
# Also strip if possible
if [ -n "${STRIP}" ]; then
"${STRIP}" "${BIN_PATH}"
fi
# Let subsequent steps know where to find the (stripped) bin
echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT
- name: Publish Release
id: publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ steps.strip.outputs.BIN_PATH }}
- name: Publish Pre-Release
id: publish-pre
if: ${{ github.ref }} == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "ncipollo/release-action@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
allowUpdates: true
tag: "nightly"
commit: "main"
name: "renku-cli nightly"
replacesArtifacts: true
artifacts: ${{ steps.strip.outputs.BIN_PATH }}

build-win:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true

- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
if [[ $PROJECT_VERSION == *-pre ]]; then
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
else
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
fi
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ matrix.features }} --release

- name: Rename binary
run: |
mv target/release/${{ env.PROJECT_NAME }}.exe target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe
- name: Publish Release
id: publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe
- name: Publish Pre-Release
id: publish-pre
if: ${{ github.ref }} == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "ncipollo/release-action@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
allowUpdates: true
tag: "nightly"
commit: "main"
name: "renku-cli nightly"
replacesArtifacts: true
artifacts: target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe

build-mac:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
override: true
default: true

- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
if [[ $PROJECT_VERSION == *-pre ]]; then
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
else
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
fi
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ matrix.features }} --release

- name: Rename and strip binary
run: |
strip target/release/${{ env.PROJECT_NAME }}
mv target/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }}
- name: Publish Release
id: publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ github.ref }} == "refs/heads/main"
files: |
target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }}
- name: Publish Pre-Release
id: publish-pre
if: ${{ github.ref }} == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "ncipollo/release-action@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
allowUpdates: true
tag: "nightly"
commit: "main"
name: "renku-cli nightly"
replacesArtifacts: true
artifacts: target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target
result*
/local
*.qcow2
.direnv/
.vscode
Loading

0 comments on commit 87f2805

Please sign in to comment.