Cargo: Bump ctor from 0.2.6 to 0.2.8 #307
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
name: Build + Test | |
on: [ push ] | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
RUST_BACKTRACE: 1 | |
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl | |
jobs: | |
backend-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
run: | | |
sudo apt-get install musl-tools | |
rustup toolchain install stable --profile minimal --no-self-update -c clippy -c rustfmt -t $CARGO_BUILD_TARGET | |
rustup default stable | |
shell: bash | |
- name: "Print Rust toolchain version" | |
run: rustc --version --verbose | |
shell: bash | |
- uses: Swatinem/rust-cache@v2 | |
- name: Fake frontend build | |
run: mkdir -p frontend/dist | |
- name: Fmt | |
run: cargo fmt --all -- --check | |
- name: Clippy | |
run: cargo clippy -- -D warnings | |
- name: Test | |
run: cargo test --all-features | |
frontend-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install deps | |
run: npm install | |
working-directory: frontend | |
- name: Lint | |
run: npm run lint | |
working-directory: frontend | |
- name: Prettier | |
run: npm run prettier | |
working-directory: frontend | |
- name: Svelte check | |
run: npm run check | |
working-directory: frontend | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- backend-check | |
- frontend-check | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Build frontend | |
run: npm install && npm run build | |
working-directory: frontend | |
- name: Setup Rust toolchain | |
run: | | |
sudo apt-get install musl-tools | |
rustup toolchain install stable --profile minimal --no-self-update -t $CARGO_BUILD_TARGET | |
rustup default stable | |
shell: bash | |
- name: "Print Rust toolchain version" | |
run: rustc --version --verbose | |
shell: bash | |
- name: "Set version" | |
id: version | |
run: | | |
REF="${{ github.ref }}" | |
if [[ "$REF" =~ ^refs/tags/v ]] ; then | |
version=${REF#refs/tags/v} | |
# checks | |
grep "version = \"$version\"" Cargo.toml > /dev/null | |
grep "\"version\": \"$version\"" frontend/package.json > /dev/null | |
else | |
version=unreleased | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "Found version: $version" | |
shell: bash | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build backend | |
run: cargo build --release --target $CARGO_BUILD_TARGET | |
- name: Package binary | |
run: | | |
cp LICENSE.txt README.md target/x86_64-unknown-linux-musl/release | |
tar -C target/x86_64-unknown-linux-musl/release \ | |
-cvaf game-of-estimates_${{ steps.version.outputs.version }}_$CARGO_BUILD_TARGET.tar.bz2 \ | |
game-of-estimates LICENSE.txt README.md | |
shell: bash | |
- name: Upload binary package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binary | |
path: game-of-estimates_${{ steps.version.outputs.version }}_${{ env.CARGO_BUILD_TARGET }}.tar.bz2 | |
if-no-files-found: error | |
- name: Login to Docker Hub | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DH_USER }} | |
password: ${{ secrets.DH_PAT }} | |
- name: Build and push container image | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: r1tschy/game-of-estimates:${{ steps.version.outputs.version }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: Release ${{ steps.version.outputs.version }} | |
draft: true | |
fail_on_unmatched_files: true | |
files: game-of-estimates_${{ steps.version.outputs.version }}_${{ env.CARGO_BUILD_TARGET }}.tar.bz2 |