mirror of
				https://github.com/TomWright/dasel.git
				synced 2022-05-22 02:32:45 +03:00 
			
		
		
		
	Add a workflow to test the build and execution
This commit is contained in:
		
							
								
								
									
										90
									
								
								.github/workflows/build-test.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								.github/workflows/build-test.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| on: | ||||
|   push: | ||||
|     branches-ignore: | ||||
|       - master | ||||
|       - main | ||||
| name: Build Test | ||||
| jobs: | ||||
|   publish: | ||||
|     strategy: | ||||
|       matrix: | ||||
|         os: | ||||
|           - linux | ||||
|           - darwin | ||||
|           - windows | ||||
|         arch: | ||||
|           - amd64 | ||||
|           - 386 | ||||
|           - arm64 | ||||
|         include: | ||||
|           - os: linux | ||||
|             arch: amd64 | ||||
|             artifact_name: dasel_linux_amd64 | ||||
|             build_docker: true | ||||
|             test_version: true | ||||
|             test_execution: true | ||||
|           - os: linux | ||||
|             arch: 386 | ||||
|             artifact_name: dasel_linux_386 | ||||
|             build_docker: false | ||||
|             test_version: false | ||||
|             test_execution: false | ||||
|           - os: darwin | ||||
|             arch: amd64 | ||||
|             artifact_name: dasel_darwin_amd64 | ||||
|             build_docker: false | ||||
|             test_version: false | ||||
|             test_execution: false | ||||
|           - os: windows | ||||
|             arch: amd64 | ||||
|             artifact_name: dasel_windows_amd64.exe | ||||
|             build_docker: false | ||||
|             test_version: false | ||||
|             test_execution: false | ||||
|           - os: windows | ||||
|             arch: 386 | ||||
|             artifact_name: dasel_windows_386.exe | ||||
|             build_docker: false | ||||
|             test_version: false | ||||
|             test_execution: false | ||||
|           - os: linux | ||||
|             arch: arm64 | ||||
|             artifact_name: dasel_linux_arm64 | ||||
|             build_docker: false | ||||
|             test_version: false | ||||
|             test_execution: false | ||||
|         exclude: | ||||
|           - os: darwin | ||||
|             arch: 386 | ||||
|           - os: darwin | ||||
|             arch: arm64 | ||||
|           - os: windows | ||||
|             arch: arm64 | ||||
|     name: Dev build ${{ matrix.os }} ${{ matrix.arch }} | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/setup-go@v2 | ||||
|         with: | ||||
|           go-version: '^1.17.0' # The Go version to download (if necessary) and use. | ||||
|       - name: Set env | ||||
|         run: echo RELEASE_VERSION=development >> $GITHUB_ENV | ||||
|       - name: Build | ||||
|         run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} CGO_ENABLED=0 go build -o target/release/${{ matrix.artifact_name }} -ldflags="-X 'github.com/tomwright/dasel/internal.Version=${{ env.RELEASE_VERSION }}'" ./cmd/dasel | ||||
|       - name: Test version | ||||
|         if: matrix.test_version == true | ||||
|         run: ./target/release/${{ matrix.artifact_name }} --version | ||||
|       - name: Test execution | ||||
|         if: matrix.test_execution == true | ||||
|         run: | | ||||
|           echo '{"hello": "World"}' | ./target/release/${{ matrix.artifact_name }} -p json '.hello' | ||||
|       - name: Build docker image | ||||
|         if: matrix.build_docker == true | ||||
|         run: | | ||||
|           docker build --build-arg daselpath=target/release/${{ matrix.artifact_name }} -f docker/Dockerfile -t tomwright/dasel:latest . | ||||
|           docker build --build-arg daselpath=target/release/${{ matrix.artifact_name }} -f docker/alpine.Dockerfile -t tomwright/dasel:alpine . | ||||
|       - name: Test docker image | ||||
|         if: matrix.build_docker == true | ||||
|         run: | | ||||
|           echo '{"hello": "World"}' | docker run -i --rm tomwright/dasel:latest -p json '.hello' | ||||
|           echo '{"hello": "World"}' | docker run -i --rm tomwright/dasel:alpine -p json '.hello' | ||||
		Reference in New Issue
	
	Block a user
	 Tom Wright
					Tom Wright