Skip to content

Commit

Permalink
improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ftheirs committed Mar 15, 2022
1 parent 1da2deb commit 71cc6be
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 9 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Verify PRs to main"

on:
pull_request:
branches:
- main

jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"

get_version:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
outputs:
version: ${{ steps.store-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Invoke `version`
shell: bash -l {0}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
run: make version

- id: store-version
run: echo ::set-output name=version::$(cat ./app/app.version)

check_app_version:
needs: get_version
runs-on: ubuntu-latest
steps:
- id: checkTag
uses: mukunku/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ needs.get_version.outputs.version }}

- run: echo ${{ steps.checkTag.outputs.exists }}

- name: Tag exists
if: ${{ steps.checkTag.outputs.exists == 'true' }}
run: exit 1
84 changes: 75 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ jobs:
source $HOME/.cargo/env
make
build_ledger_nano_SP:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build Standard app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
test_zemu:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -104,8 +125,8 @@ jobs:
export PATH=~/.cargo/bin:$PATH
make zemu_test
build_package:
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, test_zemu ]
build_package_nanos:
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, build_ledger_nano_SP, test_zemu ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
Expand All @@ -122,23 +143,68 @@ jobs:
submodules: true
- name: Install deps
run: pip install ledgerblue
- name: Build

- name: Build NanoS
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
- name: Set tag name var
id: vars
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos.sh
- name: Set tag
id: nanos
run: |
pip install ledgerblue
echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
- name: Create or Update Release
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos.sh version)
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: ./app/pkg/installer_s.sh
tag_name: ${{ steps.vars.outputs.tag_name }}
files: ./app/pkg/installer_nanos.sh
tag_name: ${{ steps.nanos.outputs.tag_name }}
draft: false
prerelease: false

build_package_nanos_plus:
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, build_ledger_nano_SP, test_zemu ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install deps
run: pip install ledgerblue

- name: Build NanoSP
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
- name: Set tag
id: nanosp
run: |
pip install ledgerblue
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_plus.sh version)
- name: Update Release
id: update_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: ./app/pkg/installer_nanos_plus.sh
tag_name: ${{ steps.nanosp.outputs.tag_name }}
draft: false
prerelease: false

0 comments on commit 71cc6be

Please sign in to comment.