Skip to content

IL name override fix #895

IL name override fix

IL name override fix #895

Workflow file for this run

# CI/CD pipeline.
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
env:
CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
jobs:
version:
name: Create a version number
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
tag: ${{ steps.create_version.outputs.tag }}
package: ${{ steps.create_version.outputs.package }}
permissions:
contents: 'write'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Create version
id: create_version
uses: degory/create-version@v0.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
env:
PRERELEASE: ${{ github.event_name == 'pull_request' }}
unit_tests:
name: Run unit tests
needs: [version]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Add GHCR package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/degory/index.json"
- name: Restore local .NET tools
run: dotnet tool restore
- name: Set build number
run: |
echo "namespace Source is class BUILD is number: string static => \"${{ needs.version.outputs.tag }}\"; si si" >src/source/build.ghul
- name: Run unit tests
run: dotnet test unit-tests
bootstrap:
name: Bootstrap compiler
needs: [version]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Add GHCR package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/degory/index.json"
- name: Restore local .NET tools
run: dotnet tool restore
- name: Bootstrap compiler
run: ./build/bootstrap.sh
env:
TAG_VERSION: ${{ needs.version.outputs.tag }}
PACKAGE_VERSION: ${{ needs.version.outputs.package }}
- uses: actions/upload-artifact@v4
with:
name: ghul-compiler-package
path: ./nupkg/ghul.compiler.${{ needs.version.outputs.package }}.nupkg
integration_tests:
needs: [version, bootstrap]
name: Run integration tests
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
timeout-minutes: 5
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Download ghul.compiler package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Uninstall ghul.compiler
if: ${{ github.actor == 'dependabot[bot]' }}
run: dotnet tool uninstall ghul.compiler
- name: Add GHCR package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/degory/index.json"
- name: Install ghul.compiler
run: dotnet tool update --local ghul.compiler --version ${{ needs.version.outputs.package }} --add-source nupkg
- name: Restore local .NET tools
run: dotnet tool restore
- name: Run integration tests
run: bash -c "set -o pipefail ; dotnet ghul-test integration-tests | tee test-results.txt"
- uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results.txt
project_tests:
needs: [version, bootstrap]
name: Run project tests
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Download ghul.compiler package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Install ghul.compiler
run: dotnet tool update --local ghul.compiler --version ${{ needs.version.outputs.package }} --add-source nupkg
- name: Restore local .NET tools
run: dotnet tool restore
- name: Run project tests
run: bash -c "set -o pipefail ; dotnet ghul-test --use-dotnet-build project-tests | tee project-test-results.txt"
- uses: actions/upload-artifact@v4
with:
name: project-test-results
path: project-test-results.txt
publish_beta_package:
needs: [version, unit_tests, integration_tests, project_tests]
name: Publish beta package
timeout-minutes: 5
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
- name: Download ghul compiler tool package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Publish beta package to GitHub
run: dotnet nuget push ./nupkg/ghul.compiler.${{ needs.version.outputs.package }}.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/degory/index.json --skip-duplicate --no-symbols
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_container:
needs: [version, unit_tests, bootstrap]
name: Build development container
outputs:
status: ${{ job.status }}
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Download ghul.compiler package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Docker login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Docker build
run: docker build . -f devcontainer-dotnet.dockerfile -t ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }} --build-arg PACKAGE_VERSION=${{ needs.version.outputs.package }}
- name: Docker push
run: docker push ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }}
container_tests:
needs: [version, build_container]
name: Run tests in development container
runs-on: ubuntu-latest
timeout-minutes: 6
container:
image: ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
env:
HOST: dotnet
TARGET: dotnet
GHUL_V3: true
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Add .NET tools to PATH
run: echo "${HOME}/.dotnet/tools" >> $GITHUB_PATH
- name: Install ghul.test
run: dotnet tool install --global ghul.test
- name: Remove tool manifest
run: rm -rf .config
- name: Run integration tests
run: bash -c "set -o pipefail ; ghul-test integration-tests | tee test-results.txt"
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: container-test-results
path: test-results.txt
tag_containers:
needs: [version, container_tests]
name: Tag containers
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Docker login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Docker login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER_NAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker pull
run: docker pull ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }}
- name: Docker tag GHCR stable
run: docker tag ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }} ghcr.io/degory/ghul/devcontainer:dotnet
- name: Docker push GHCR stable
run: docker push ghcr.io/degory/ghul/devcontainer:dotnet
- name: Docker tag Docker Hub versioned
run: docker tag ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }} degory/ghul-devcontainer:dotnet-${{ needs.version.outputs.tag }}
- name: Docker push Docker Hub versioned
run: docker push degory/ghul-devcontainer:dotnet-${{ needs.version.outputs.tag }}
- name: Docker tag Docker Hub stable
run: docker tag ghcr.io/degory/ghul/devcontainer:dotnet-${{ needs.version.outputs.tag }} degory/ghul-devcontainer:dotnet
- name: Docker push Docker Hub stable
run: docker push degory/ghul-devcontainer:dotnet
publish_release_package:
needs: [version, unit_tests, project_tests, container_tests]
name: Publish release package
timeout-minutes: 5
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Download ghul compiler tool package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Publish release package to GitHub
run: dotnet nuget push ./nupkg/ghul.compiler.${{ needs.version.outputs.package }}.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/degory/index.json --skip-duplicate --no-symbols
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release package to NuGet
run: dotnet nuget push ./nupkg/ghul.compiler.${{ needs.version.outputs.package }}.nupkg -k ${NUGET_TOKEN} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
create_release:
needs: [version, container_tests, publish_release_package]
name: Create release
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Download ghul compiler tool package
uses: actions/download-artifact@v4
with:
name: ghul-compiler-package
path: nupkg
- name: Create changelog
run: git log -1 --format="%s%n%n%b%n%n" >changelog.txt
- name: Create a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.tag }}
release_name: ${{ needs.version.outputs.tag }}
body_path: changelog.txt
draft: false
- name: Upload package asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nupkg/ghul.compiler.${{ needs.version.outputs.package }}.nupkg
asset_name: ghul.compiler.${{ needs.version.outputs.package }}.nupkg
asset_content_type: application/octet-stream