Update issue templates #67
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, and Publish Pseudolang | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
workflow_dispatch: | |
permissions: write-all | |
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 | |
- wasm32-unknown-unknown | |
- wasm32-wasip1 | |
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 | |
if: ${{ !contains(matrix.target, 'wasm') }} | |
run: cargo install cross | |
- name: Install wasm-pack | |
if: matrix.target == 'wasm32-unknown-unknown' | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build WASM | |
if: matrix.target == 'wasm32-unknown-unknown' | |
run: | | |
cargo build --release --target wasm32-unknown-unknown --features wasm | |
mkdir -p release/wasm | |
cp target/wasm32-unknown-unknown/release/fplc.wasm release/wasm/ | |
- name: Build WASM (Raw) | |
if: matrix.target == 'wasm32-unknown-unknown' | |
run: | | |
cargo build --release --target wasm32-unknown-unknown --features wasm | |
mkdir -p release | |
cp target/wasm32-unknown-unknown/release/fplc.wasm release/fplc-raw.wasm | |
- name: Build WASM (Bindgen) | |
if: matrix.target == 'wasm32-unknown-unknown' | |
run: | | |
wasm-pack build --target web --release -- --features "wasm bindgen" | |
mkdir -p release/wasm-bindgen | |
cp pkg/fplc_bg.wasm release/wasm-bindgen/ | |
cp pkg/fplc.js release/wasm-bindgen/ | |
cp pkg/fplc.d.ts release/wasm-bindgen/ | |
cp pkg/fplc_bg.wasm.d.ts release/wasm-bindgen/ | |
cd release && zip -r wasm-bindgen.zip wasm-bindgen/ | |
- name: Upload Raw WASM Artifact | |
if: matrix.target == 'wasm32-unknown-unknown' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pseudolang-raw-wasm | |
path: release/fplc-raw.wasm | |
retention-days: 7 | |
if-no-files-found: error | |
- name: Upload Bindgen WASM Artifact | |
if: matrix.target == 'wasm32-unknown-unknown' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pseudolang-wasm-bindgen | |
path: release/wasm-bindgen.zip | |
retention-days: 7 | |
if-no-files-found: error | |
- name: Build Native | |
if: ${{ !contains(matrix.target, 'wasm') }} | |
run: cross build --release --target ${{ matrix.target }} --features native | |
- name: Build WASI | |
if: matrix.target == 'wasm32-wasip1' | |
run: | | |
cargo build --release --target wasm32-wasip1 --features wasi | |
mkdir -p release/wasi | |
cp target/wasm32-wasip1/release/fplc.wasm release/wasi/ | |
- name: Prepare Artifacts | |
if: ${{ !contains(matrix.target, 'wasm') }} | |
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/ | |
elif [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then | |
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 | |
- name: Upload WASM Artifacts | |
if: matrix.target == 'wasm32-unknown-unknown' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pseudolang-wasm | |
path: pkg/* | |
retention-days: 7 | |
if-no-files-found: error | |
publish: | |
name: Publish Release | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
discussions: write | |
pull-requests: write | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '.') && startsWith(github.event.head_commit.message, '0.') || startsWith(github.event.head_commit.message, '1.') || startsWith(github.event.head_commit.message, '2.') || startsWith(github.event.head_commit.message, '3.') || startsWith(github.event.head_commit.message, '4.') || startsWith(github.event.head_commit.message, '5.') || startsWith(github.event.head_commit.message, '6.') || startsWith(github.event.head_commit.message, '7.') || startsWith(github.event.head_commit.message, '8.') || startsWith(github.event.head_commit.message, '9.') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create Git Tag | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
TAG_NAME=$(git log -1 --pretty=%s | grep -oE '\b[0-9]+\.[0-9]+\.[0-9]+\b') | |
TAG_NAME="v${TAG_NAME}" | |
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
echo "Tag $TAG_NAME already exists. Skipping tag creation." | |
else | |
git tag "$TAG_NAME" | |
git push origin "$TAG_NAME" | |
fi | |
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | |
- name: Download Windows Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-x86_64-pc-windows-gnu | |
path: artifacts/windows | |
- name: Download Linux Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-x86_64-unknown-linux-gnu | |
path: artifacts/linux | |
- name: Download WASI Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-wasm32-wasip1 | |
path: artifacts/wasi | |
- name: Download WASM Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-wasm32-unknown-unknown | |
path: artifacts/wasm | |
- name: Download Raw WASM Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-raw-wasm | |
path: artifacts/wasm-raw | |
- name: Download Bindgen WASM Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pseudolang-wasm-bindgen | |
path: artifacts/wasm-bindgen | |
- name: Prepare Release Files | |
run: | | |
mkdir -p release | |
cp artifacts/windows/fplc-x64.exe release/ | |
cp artifacts/windows/pseudolang-setup-x64.exe release/ || true | |
cp artifacts/linux/fplc-linux-x64 release/ | |
cp artifacts/wasi/wasi/fplc.wasm release/fplc-wasi.wasm || true | |
cp artifacts/wasm-raw/fplc-raw.wasm release/ || true | |
cp artifacts/wasm-bindgen/wasm-bindgen.zip release/ || true | |
chmod +x release/fplc-linux-x64 | |
- name: Create Release and Upload Assets | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ env.TAG_NAME }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
name: Pseudolang ${{ env.TAG_NAME }} | |
body: | | |
See the full changelog: https://github.com/${{ github.repository }}/compare/${{ env.TAG_NAME }}~1...${{ env.TAG_NAME }} | |
files: | | |
release/fplc-x64.exe | |
release/fplc-linux-x64 | |
release/pseudolang-setup-x64.exe | |
release/fplc-wasi.wasm | |
release/fplc-raw.wasm | |
release/wasm-bindgen.zip |