Workflow file for this run
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 and Test Pseudolang | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Run Tests | |
run: cargo test --verbose | |
build: | |
name: Build Multi-Platform | |
needs: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-pc-windows-gnu | |
- x86_64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install Cross | |
run: cargo install cross | |
- name: Build Release | |
run: cross build --release --target ${{ matrix.target }} | |
- name: Prepare Artifacts | |
run: | | |
mkdir -p release | |
mkdir -p installer | |
if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then | |
cp target/${{ matrix.target }}/release/fplc.exe release/fplc-x64.exe | |
cp release/fplc-x64.exe installer/fplc.exe | |
cp LICENSE installer/ | |
cp installer/Pseudolang-Logo.ico installer/ | |
else | |
cp target/${{ matrix.target }}/release/fplc release/fplc-linux-x64 | |
chmod +x release/fplc-linux-x64 | |
fi | |
- name: Install NSIS | |
if: matrix.target == 'x86_64-pc-windows-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y nsis | |
- name: Build Windows Installer | |
if: matrix.target == 'x86_64-pc-windows-gnu' | |
run: | | |
mkdir -p release/installer | |
makensis installer/pseudolang.nsi | |
cp release/installer/pseudolang-setup-x64.exe release/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pseudolang-${{ matrix.target }} | |
path: release/* | |
retention-days: 7 | |
if-no-files-found: error | |
- name: Upload Installer Artifact | |
if: matrix.target == 'x86_64-pc-windows-gnu' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pseudolang-installer | |
path: release/installer/pseudolang-setup-x64.exe | |
retention-days: 7 | |
if-no-files-found: error | |
publish: | |
name: Publish Release | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
pattern: pseudolang-* | |
merge-multiple: true | |
- name: Prepare Release Files | |
run: | | |
mkdir -p release | |
cp artifacts/pseudolang-x86_64-pc-windows-gnu/fplc-x64.exe release/ | |
cp artifacts/pseudolang-x86_64-pc-windows-gnu/pseudolang-setup-x64.exe release/ | |
cp artifacts/pseudolang-x86_64-unknown-linux-gnu/fplc-linux-x64 release/ | |
chmod +x release/fplc-linux-x64 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.run_number }} | |
release_name: Release v${{ github.run_number }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release/fplc-x64.exe | |
asset_name: fplc-x64.exe | |
asset_content_type: application/octet-stream | |
- name: Upload Installer Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release/pseudolang-setup-x64.exe | |
asset_name: pseudolang-setup-x64.exe | |
asset_content_type: application/octet-stream | |
- name: Upload Linux Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release/fplc-linux-x64 | |
asset_name: fplc-linux-x64 | |
asset_content_type: application/octet-stream |