From daf66a259a0271557ebc6ff91391a109954e409c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20K=C3=B8hler=20Warmdahl?= Date: Wed, 20 Nov 2024 09:17:13 +0100 Subject: [PATCH] Add linux build --- .github/workflows/release.yaml | 248 +++++++++++++++++++-------------- 1 file changed, 147 insertions(+), 101 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a4f4c9..79d42c7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,6 +2,8 @@ name: Build and Push rosetta on: push: + branches: + - ekw/SRE-999/release-rosetta tags: - "*.*.*" @@ -35,56 +37,151 @@ jobs: echo "::error::$CARGO_VERSION does not match ${{ github.ref_name }}." exit 1 fi - echo "outfile=${{ env.OUTFOLDER }}/windows/concordium-rosetta-test-$CARGO_VERSION" >> $GITHUB_OUTPUT - - release-rosetta-macos: - needs: rosetta-version - runs-on: macos-latest - environment: release - env: - OUTFILE: ${{needs.rosetta-version.outputs.OUTFILE_SHORT}} - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ github.ref_name }} - submodules: recursive - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-region: "eu-west-1" - role-to-assume: ${{ env.IAM_ROLE }} - role-session-name: ReleaseRosettaSession - - - - name: Check if version exist in s3 - run: | - set +e - output=$(aws s3 ls "${{ env.OUTFILE }}") - ec=$? - if [ $ec -eq "0" ]; then - echo "Objects found ${{ env.OUTFILE }}" - exit 1 - elif [ $ec -ne "1" ]; then - echo "$output" - fi - - - name: Build - run: | - rustup default ${{ env.RUST_IMAGE_TAG }} - cargo run --release -- --version - - - name: Publish - run: | - aws s3 cp ./target/release/concordium-rosetta ${{ env.OUTFILE }} - - release-rosetta-windows: - runs-on: windows-latest + echo "outfile=concordium-rosetta-test-$CARGO_VERSION" >> $GITHUB_OUTPUT + +# release-rosetta-macos: +# needs: rosetta-version +# runs-on: macos-latest +# environment: release +# env: +# OUTFILE: ${{env.OUTFOLDER}}/macos/${{needs.rosetta-version.outputs.OUTFILE_SHORT}} +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v4 +# with: +# ref: ${{ github.ref_name }} +# submodules: recursive +# +# - name: Configure AWS Credentials +# uses: aws-actions/configure-aws-credentials@v4 +# with: +# aws-region: "eu-west-1" +# role-to-assume: ${{ env.IAM_ROLE }} +# role-session-name: ReleaseRosettaSession +# +# +# - name: Check if version exist in s3 +# run: | +# set +e +# output=$(aws s3 ls "${{ env.OUTFILE }}") +# ec=$? +# if [ $ec -eq "0" ]; then +# echo "Objects found ${{ env.OUTFILE }}" +# exit 1 +# elif [ $ec -ne "1" ]; then +# echo "$output" +# fi +# +# - name: Build +# run: | +# rustup default ${{ env.RUST_IMAGE_TAG }} +# cargo run --release -- --version +# +# - name: Publish +# run: | +# aws s3 cp ./target/release/concordium-rosetta ${{ env.OUTFILE }} +# +# release-rosetta-windows: +# runs-on: windows-latest +# needs: rosetta-version +# environment: release +# env: +# OUTFILE: "${{env.OUTFOLDER}}/windows/${{needs.rosetta-version.outputs.OUTFILE_SHORT}}.exe" +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v4 +# with: +# ref: ${{ github.ref_name }} +# submodules: recursive +# +# - name: Configure AWS Credentials +# uses: aws-actions/configure-aws-credentials@v4 +# with: +# aws-region: "eu-west-1" +# role-to-assume: ${{ env.IAM_ROLE }} +# role-session-name: ReleaseRosettaSession +# +# +# - name: Check if version exist in s3 +# run: |- +# set +e +# output=$(aws s3 ls "${{ env.OUTFILE }}") +# ec=$? +# if [ $ec -eq "0" ]; then +# echo "Objects found ${{ env.OUTFILE }}" +# exit 1 +# elif [ $ec -ne "1" ]; then +# echo "$output" +# fi +# shell: bash +# +# - name: Build +# run: | +# rustup default ${{ env.RUST_IMAGE_TAG }} +# cargo run --release -- --version +# +# - name: Publish +# run: | +# aws s3 cp ./target/release/concordium-rosetta.exe ${{ env.OUTFILE }} +# +# release-rosetta-docker: +# runs-on: ubuntu-latest +# environment: release +# steps: +# +# - name: Login to Docker Hub +# if: ${{ secrets.DOCKERHUB_TOKEN }} +# uses: docker/login-action@v3 +# with: +# username: 'concordium' +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# +# - name: Checkout Repository +# uses: actions/checkout@v4 +# with: +# ref: ${{ github.ref_name }} +# submodules: recursive +# +# - name: Set image tag if correctly formatted +# run: | +# TAG_VERSION=${{ github.ref_name }} +# if [ -n "Cargo.toml" ] ; then +# CARGO_VERSION=$(yq .package.version "Cargo.toml") +# if [ ! "$TAG_VERSION" = "$CARGO_VERSION" ] ; then +# echo "::error::$CARGO_VERSION does not match $TAG_VERSION." +# exit 1 +# fi +# fi +# echo "FULL_IMAGE_TAG=concordium/rosetta:${TAG_VERSION}" >> $GITHUB_ENV +# +# - name: Check if image exist +# run: | +# set +e +# docker manifest inspect ${{ env.FULL_IMAGE_TAG }} +# EXITCODE=$? +# if [ $EXITCODE -eq "0" ]; then +# echo "Error: ${{ env.FULL_IMAGE_TAG }} already exist" +# exit 1 +# fi +# +# - name: Build and push docker image +# uses: docker/build-push-action@v6 +# with: +# context: '.' +# file: Dockerfile +# tags: ${{ env.FULL_IMAGE_TAG }} +# no-cache: true +# push: true +# build-args: | +# base_image=${{ env.BASE_IMAGE }} +# build_image=rust:${{ env.RUST_IMAGE_TAG }}-slim-bullseye + + release-rosetta-linux: + runs-on: ubuntu-latest needs: rosetta-version environment: release env: - OUTFILE: "${{needs.rosetta-version.outputs.OUTFILE_SHORT}}.exe" + OUTFILE: ${{env.OUTFOLDER}}/linux/${{needs.rosetta-version.outputs.OUTFILE_SHORT}}.deb steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -111,7 +208,6 @@ jobs: elif [ $ec -ne "1" ]; then echo "$output" fi - shell: bash - name: Build run: | @@ -120,56 +216,6 @@ jobs: - name: Publish run: | - aws s3 cp ./target/release/concordium-rosetta.exe ${{ env.OUTFILE }} - - release-rosetta-docker: - runs-on: ubuntu-latest - environment: release - steps: - - - name: Login to Docker Hub - if: ${{ secrets.DOCKERHUB_TOKEN }} - uses: docker/login-action@v3 - with: - username: 'concordium' - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ github.ref_name }} - submodules: recursive - - - name: Set image tag if correctly formatted - run: | - TAG_VERSION=${{ github.ref_name }} - if [ -n "Cargo.toml" ] ; then - CARGO_VERSION=$(yq .package.version "Cargo.toml") - if [ ! "$TAG_VERSION" = "$CARGO_VERSION" ] ; then - echo "::error::$CARGO_VERSION does not match $TAG_VERSION." - exit 1 - fi - fi - echo "FULL_IMAGE_TAG=concordium/rosetta:${TAG_VERSION}" >> $GITHUB_ENV - - - name: Check if image exist - run: | - set +e - docker manifest inspect ${{ env.FULL_IMAGE_TAG }} - EXITCODE=$? - if [ $EXITCODE -eq "0" ]; then - echo "Error: ${{ env.FULL_IMAGE_TAG }} already exist" - exit 1 - fi - - - name: Build and push docker image - uses: docker/build-push-action@v6 - with: - context: '.' - file: Dockerfile - tags: ${{ env.FULL_IMAGE_TAG }} - no-cache: true - push: true - build-args: | - base_image=${{ env.BASE_IMAGE }} - build_image=rust:${{ env.RUST_IMAGE_TAG }}-slim-bullseye + echo ${{ env.OUTFILE }} + ls ./target/release/concordium-rosetta.deb +# aws s3 cp ./target/release/concordium-rosetta.exe ${{ env.OUTFILE }} \ No newline at end of file