Skip to content

support customize log,index,crates etc. path in config file (#35) #45

support customize log,index,crates etc. path in config file (#35)

support customize log,index,crates etc. path in config file (#35) #45

Workflow file for this run

name: Continuous Integration (CI)
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: |
rustup component add rustfmt
cargo check
cargo fmt --check
cargo test --workspace
release:
name: release ${{ matrix.binary.name }} ${{ matrix.arch.name }}
needs: [test]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
binary:
- workspace: .
name: freighter
arch:
- name: amd64
runtime-image: "debian@sha256:9b42b2e7eddd84eaddb67b45567cdc0e03ec826bf252352f300147cfb8ce5a6d"
- name: aarch64
runtime-image: "debian@sha256:c583ed77e10b69b167c09cba3d82f903a9a7af481cbb75166d5307135f7b2c77"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup QEMU
if: matrix.arch.name != 'amd64'
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Setup Rust
run: |
rm -rf ~/.cargo
docker run -d --name=init \
-v $PWD/${{ matrix.binary.workspace }}:/repo/ -w /repo \
ghcr.io/innopals/rust-centos7:$(cat rust-toolchain)-${{ matrix.arch.name }} \
tail -f /etc/issue
docker cp init:/root/.cargo ~/.cargo
mkdir -p ${HOME}/.local/bin
cd ${HOME}/.local/bin
echo '#!/bin/bash' > rustc
echo 'docker exec init rustc $@' > rustc
echo '#!/bin/bash' > cargo
echo 'docker exec init cargo $@' > cargo
chmod +x *
rustc -vV
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.binary.workspace }}/${{ matrix.binary.name }}-${{ matrix.arch.name }}
cache-on-failure: true
workspaces: ${{ matrix.binary.workspace }} -> target
- name: Start Build Container
run: |
docker run -d --name=build \
-v $PWD/${{ matrix.binary.workspace }}:/repo/ -v $HOME/.cargo:/root/.cargo -w /repo \
ghcr.io/innopals/rust-centos7:$(cat rust-toolchain)-${{ matrix.arch.name }} \
tail -f /etc/issue
- name: Build Artifacts
run: |
docker exec build bash -c 'set -e
cargo build --release
strip target/release/${{ matrix.binary.name }}
cp target/release/${{ matrix.binary.name }} target/release/${{ matrix.binary.name }}-${{ matrix.arch.name }}
'
sudo chown -R runner:docker ${{ matrix.binary.workspace }}/target
sudo chown -R runner:docker $HOME/.cargo
- name: Publish Artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
${{ matrix.binary.workspace }}/target/release/${{ matrix.binary.name }}-${{ matrix.arch.name }}
- name: Draft Artifacts
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
draft: true
name: "latest"
tag_name: "latest"
files: |
${{ matrix.binary.workspace }}/target/release/${{ matrix.binary.name }}-${{ matrix.arch.name }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Nightly Docker Image
run: |
export IMAGE_TAG="ghcr.io/${{ github.repository }}-nightly:${{ matrix.arch.name }}-${{ github.sha }}"
echo "Building image $IMAGE_TAG"
docker buildx build \
--push \
--build-arg RUNTIME_IMAGE=${{ matrix.arch.runtime-image }} \
-t $IMAGE_TAG .
release-image:
if: startsWith(github.ref, 'refs/tags/')
name: release docker image
needs: [release]
runs-on: ubuntu-22.04
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Docker Image
run: |
docker pull ghcr.io/${{ github.repository }}-nightly:amd64-${{ github.sha }}
docker pull ghcr.io/${{ github.repository }}-nightly:aarch64-${{ github.sha }}
export IMAGE_TAG="ghcr.io/${{ github.repository }}:${{ github.ref_name }}"
docker manifest create $IMAGE_TAG \
--amend ghcr.io/${{ github.repository }}-nightly:amd64-${{ github.sha }} \
--amend ghcr.io/${{ github.repository }}-nightly:aarch64-${{ github.sha }}
docker manifest push --purge $IMAGE_TAG