fix: update test file paths to use HOME or USERPROFILE environment va… #83
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: Rust | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: | |
| - 'plcviz-v*' | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --lib --verbose | |
| release: | |
| name: Build and Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| suffix: '' | |
| archive: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| suffix: .exe | |
| archive: zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract crate name and version from tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| CRATE=$(echo $TAG | sed 's/-v.*//') | |
| VERSION=$(echo $TAG | sed 's/.*-v//') | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "crate=$CRATE" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building $CRATE version $VERSION" | |
| - name: Build release binary | |
| run: cargo build --release -p ${{ steps.tag.outputs.crate }} | |
| - name: Create release archive (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p release | |
| cp target/release/${{ steps.tag.outputs.crate }} release/ | |
| cp ${{ steps.tag.outputs.crate }}/README.md release/ || true | |
| cp ${{ steps.tag.outputs.crate }}/LICENSE release/ || true | |
| cp ${{ steps.tag.outputs.crate }}/CHANGELOG.md release/ || true | |
| cd release | |
| tar czf ../${{ steps.tag.outputs.crate }}-v${{ steps.tag.outputs.version }}-x86_64-linux.tar.gz * | |
| - name: Create release archive (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| cp target/release/${{ steps.tag.outputs.crate }}.exe release/ | |
| cp ${{ steps.tag.outputs.crate }}/README.md release/ || true | |
| cp ${{ steps.tag.outputs.crate }}/LICENSE release/ || true | |
| cp ${{ steps.tag.outputs.crate }}/CHANGELOG.md release/ || true | |
| cd release | |
| 7z a ../${{ steps.tag.outputs.crate }}-v${{ steps.tag.outputs.version }}-x86_64-windows.zip * | |
| - name: Upload Release Asset | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ${{ steps.tag.outputs.crate }}-v${{ steps.tag.outputs.version }}-*.tar.gz | |
| ${{ steps.tag.outputs.crate }}-v${{ steps.tag.outputs.version }}-*.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |