Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone workflow #855

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e8cf9c
Added standalone workflow
cschuchardt88 Jan 4, 2024
50718ce
Update description for inputs
cschuchardt88 Jan 4, 2024
0a22e23
step command fix
cschuchardt88 Jan 4, 2024
bf51d2c
Change dotnet command
cschuchardt88 Jan 4, 2024
ff71dbd
Fix dotnet command again
cschuchardt88 Jan 4, 2024
79ee035
Add file icon for nccs
cschuchardt88 Jan 4, 2024
8ac3be9
Merge branch 'master' into standalone-workflow
cschuchardt88 Jan 4, 2024
5e42a19
Merge branch 'master' into standalone-workflow
cschuchardt88 Jan 18, 2024
aded976
Merge branch 'master' into standalone-workflow
Jim8y Jan 19, 2024
2e00dc5
Merge branch 'master' into standalone-workflow
shargon Jan 22, 2024
4652dc7
Merge branch 'master' into standalone-workflow
Jim8y Feb 4, 2024
9f2aca7
Merge branch 'master' into standalone-workflow
cschuchardt88 Feb 10, 2024
4c9648b
Merge branch 'master' into standalone-workflow
Jim8y Feb 12, 2024
f6641f1
Added cleanup to workflow
cschuchardt88 Feb 12, 2024
c4adf04
Fixed names
cschuchardt88 Feb 12, 2024
7ceed88
submodules
cschuchardt88 Feb 12, 2024
1ff74c7
Merge branch 'master' into standalone-workflow
Jim8y Feb 26, 2024
dd8090b
Merge branch 'master' into standalone-workflow
vncoelho Mar 18, 2024
3db1647
Updated `standalone.yml` workdlow
cschuchardt88 Mar 21, 2024
1e82bcd
Merge branch 'neo-project:master' into standalone-workflow
cschuchardt88 Mar 21, 2024
8110d41
Add `APP_VERSION` environment variable
cschuchardt88 Mar 21, 2024
ccb585a
Merge branch 'standalone-workflow' of https://github.com/cschuchardt8…
cschuchardt88 Mar 21, 2024
efae588
Remoted published protperty for `dotnet`
cschuchardt88 Mar 21, 2024
3544e99
Added `submodules: recursive` to `standalone.yml` workflow
cschuchardt88 Mar 21, 2024
eb921f4
Fixed app version parsing
cschuchardt88 Mar 21, 2024
c855e94
Fixed type with `Neo.Compiler.CSharp.csproj` settings
cschuchardt88 Mar 21, 2024
0101e50
Merge branch 'master' into standalone-workflow
cschuchardt88 Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Publish & Release (nccs)

on:
release:
types: [published]

env:
DOTNET_VERSION: 7.0.x
CONFIGURATION: Release
DIST_PATH: /tmp/dist
OUTPUT_PATH: /tmp/out

jobs:
build-nccs:
name: Build (${{ matrix.runtime }})
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [linux-x64, linux-arm64, linux-musl-arm64, osx-x64, osx-arm64, win-x64, win-arm64]

steps:
- name: Set Application Version (Environment Variable)
run: |
APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
AnnaShaleva marked this conversation as resolved.
Show resolved Hide resolved

- name: Checkout Repository Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: .NET Publish (nccs)
run: |
dotnet publish ./src/Neo.Compiler.CSharp \
--framework net7.0 \
--configuration ${{ env.CONFIGURATION }} \
--runtime ${{ matrix.runtime }} \
--self-contained true \
--output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \
--verbosity normal \
-p:RuntimeIdentifier=${{ matrix.runtime }} \
-p:SelfContained=true \
-p:IncludeNativeLibrariesForSelfExtract=false \
-p:PublishTrimmed=false \
-p:PublishSingleFile=true \
-p:PublishReadyToRun=true \
-p:EnableCompressionInSingleFile=true \
-p:DebugType=embedded \
-p:ServerGarbageCollection=true

# - name: Remove Xml Comment Files
# working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}
# run: rm -v *.xml
Comment on lines +57 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this commented code?


- name: Create Distribution Directory
run: mkdir -p ${{ env.DIST_PATH }}

- name: Create Tarball File (linux)
if: ${{ startsWith(matrix.runtime, 'linux') }}
working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}
run: tar -czvf ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz .

- name: Create Tarball File (osx)
if: ${{ startsWith(matrix.runtime, 'osx') }}
working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}
run: tar -cJf ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz .

- name: Create Zip File (win)
if: ${{ startsWith(matrix.runtime, 'win') }}
working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}
run: zip ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip -r *

- name: Create Checksum File (linux)
if: ${{ startsWith(matrix.runtime, 'linux') }}
working-directory: ${{ env.DIST_PATH }}
env:
FILENAME: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}
run: sha256sum ${{ env.FILENAME }}.tar.gz > ${{ env.FILENAME }}.sha256

- name: Create Checksum File (osx)
if: ${{ startsWith(matrix.runtime, 'osx') }}
working-directory: ${{ env.DIST_PATH }}
env:
FILENAME: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}
run: sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256

- name: Create Checksum File (win)
if: ${{ startsWith(matrix.runtime, 'win') }}
working-directory: ${{ env.DIST_PATH }}
env:
FILENAME: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}
run: sha256sum ${{ env.FILENAME }}.zip > ${{ env.FILENAME }}.sha256
Comment on lines +79 to +98
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of unnecessary copy-past. Matrix strategy support structured variables, so in the matrix runtime enumeration add suffix of the desired checksum file and unify these three steps:

    strategy:
      matrix:
        runtime: [{os: linux-x64, checksumExt: .tar.gz}, ...]

See the example in https://github.com/nspcc-dev/neo-go/blob/b028c772f2c592a22796484dfab8f848ca8ed2de/.github/workflows/build.yml#L40.


- name: Output/Distribution Directory Contents
run: |
ls -l ${{ env.DIST_PATH }}
ls -l ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}

- name: Upload Tarball File (linux)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same optimisation may be done with uploading steps.

if: ${{ startsWith(matrix.runtime, 'linux') }}
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz
asset_name: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz
asset_content_type: application/x-gtar

- name: Upload Tarball File (osx)
if: ${{ startsWith(matrix.runtime, 'osx') }}
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz
asset_name: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz
asset_content_type: application/x-gtar

- name: Upload Zip File (win)
if: ${{ startsWith(matrix.runtime, 'win') }}
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip
asset_name: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip
asset_content_type: application/zip

- name: Upload Checksum File (all)
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.DIST_PATH }}/nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256
asset_name: nccs.${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256
asset_content_type: text/plain
5 changes: 5 additions & 0 deletions src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Description>Neo.Compiler.CSharp</Description>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<ApplicationIcon>neo.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,4 +32,8 @@
<ProjectReference Include="..\Neo.SmartContract.Testing\Neo.SmartContract.Testing.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="./neo.ico" Visible="false" Pack="true" />
</ItemGroup>

</Project>
Binary file added src/Neo.Compiler.CSharp/neo.ico
Binary file not shown.
Loading