Skip to content

(stdlib) Ensure ASCIIStrings contain ASCII content only #741

(stdlib) Ensure ASCIIStrings contain ASCII content only

(stdlib) Ensure ASCIIStrings contain ASCII content only #741

name: .NET publish snapshot packages
# Technically, this could be conditionalized on the following paths:
#
# - .github/workflows/publish-packages.yml
# - src/**
#
# However, doing so means the workflow will never run on e.g. docs/ PRs. This is
# bad because the job is a "mandatory job", required for CI to be considered
# green. Hence, the easy way out is to let it run unconditionally.
#
# The underlying cause here is a limitation in GitHub:
# https://github.community/t/feature-request-conditional-required-checks/16761
on: [push]
defaults:
run:
shell: bash --noprofile --norc -eo pipefail -O inherit_errexit {0}
jobs:
publish-snapshot-packages:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
# Note: make sure to keep this list in sync with the list in
# publish-release-packages.yml
- linux-arm
- linux-arm64
- linux-x64
- osx-arm64
- osx-x64
- win-x64
steps:
- uses: actions/checkout@v1
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Re-generate auto-generated files
run: make auto-generated
#
# Build releases
#
- name: Build host-compatible release
run: dotnet build
# How's this for an interesting chicken-and-egg: we need the latest Perlang snapshot to be able to build the
# Perlang CLI shared library. :) This if of course completely intentional, since we write Perlang in Perlang.
# Fortunately for us, we don't really *need* the Perlang snapshot to bootstrap a new platform, only for
# rebuilding the CLI solib for when the version.per file has been modified.
#
# This chicken-and-egg problem _can_ cause real problems though. At times, we might need a newer snapshot than the
# one currently available to properly build our code for the snapshot; this happened to me right now because I
# needed some special semantics only available in a very recent snapshot, and no such snapshot was available
# (because of an unrelated CI problem). The most reasonable way to evade such problems may be to manually
# build and publish a snapshot from a developer machine if/when this happens.
- name: Install a Perlang snapshot build
run: scripts/perlang-install
# This is needed to be able to run `perlang -v` a few commands below
- name: Build Perlang CLI shared library and copy to debug directory
run: make perlang_cli_clean perlang_cli_install_debug
- name: Build ${{ matrix.arch }} release
run: dotnet publish src/Perlang.ConsoleApp/Perlang.ConsoleApp.csproj -c Release -r ${{ matrix.arch }} --self-contained true /p:PublishReadyToRun=true /p:SolutionDir=$(pwd)/
# We need perlang_cli.so to be present in the published snapshot
- name: Build Perlang CLI shared library and copy to release directory
run: make perlang_cli_install_release ARCH=${{ matrix.arch }}
- name: Rebuild stdlib
run: make stdlib && cp -rv lib src/Perlang.ConsoleApp/bin/Release/net8.0/${{ matrix.arch }}/publish
if: runner.os == 'Linux'
#
# Create .tar.gz archives
#
- name: Create ${{ matrix.arch }} .tar.gz file
run: version=$(${GITHUB_WORKSPACE}/src/Perlang.ConsoleApp/bin/Debug/net8.0/perlang -v) && tar cvzf ../perlang-$version-${{ matrix.arch }}.tar.gz *
working-directory: src/Perlang.ConsoleApp/bin/Release/net8.0/${{ matrix.arch }}/publish
- name: List .tar.gz files
run: ls -l src/Perlang.ConsoleApp/bin/Release/net8.0/*/*.tar.gz
#
# Upload files to releases server via rsync
#
- name: Upload ${{ matrix.arch }} .tar.gz file to releases server
uses: easingthemes/ssh-deploy@v2.1.1
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "./src/Perlang.ConsoleApp/bin/Release/net8.0/${{ matrix.arch }}/*.tar.gz"
REMOTE_HOST: ${{ secrets.SSH_REMOTE_HOST }}
REMOTE_USER: ${{ secrets.SSH_REMOTE_USER }}
TARGET: ${{ secrets.SSH_REMOTE_TARGET }}
if: github.ref == 'refs/heads/master'
# TODO: Would ideally run _after_ all jobs of the matrix...
- name: Update latest build symlink
uses: appleboy/ssh-action@v0.1.1
with:
host: ${{ secrets.SSH_REMOTE_HOST }}
username: ${{ secrets.SSH_REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: ${{ secrets.UPDATE_SYMLINK_CMD }}
if: github.ref == 'refs/heads/master'