Explicit $lib alias as try to fix CI build #396
This file contains hidden or 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: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install NPM deps | |
| run: npm clean-install | |
| working-directory: frontend | |
| - name: Prettier | |
| run: npm run prettier | |
| working-directory: frontend | |
| - name: Sync SvelteKit | |
| run: npx svelte-kit sync && cat .svelte-kit/tsconfig.json | |
| working-directory: frontend | |
| - name: Build frontend | |
| run: npm run build | |
| working-directory: frontend | |
| - name: Svelte check | |
| run: npm run check | |
| working-directory: frontend | |
| - 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 | |
| - 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: Cargo Fmt | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Cargo Test | |
| run: cargo test --all-features | |
| - 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@v4 | |
| 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 |