Skip to content

Commit

Permalink
Merge branch 'master' into add-quality-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
soffokl authored Feb 20, 2024
2 parents 8824b7d + b1b6e97 commit b7a6fa1
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 73 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build packages
# Big chunk of the build process logic is in the mage build targets
on:
workflow_call:
push:
branches: [master]
tags:

# Mage's `GenerateEnvFile` talks to GH API to setup tags, versions, etc.
env:
GITHUB_OWNER: mysteriumnetwork
GITHUB_REPO: node
GITHUB_SNAPSHOT_REPO: node-builds
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build-packages:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
matrix:
platform:
- PackageLinuxRaspberryImage
- PackageLinuxAmd64
- PackageLinuxArm
- PackageLinuxDebianAmd64
- PackageLinuxDebianArm64
- PackageLinuxDebianArm
- PackageMacOSAmd64
- PackageMacOSArm64
- PackageWindowsAmd64
- PackageAndroid
- PackageAndroidProvider

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
- name: Generate Env
run: go run mage.go -v GenerateEnvFile

- name: Setup FPM
run: |
sudo apt-get install ruby-dev build-essential
sudo gem i fpm -f
- name: Build package
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source build/env.sh
# Following line ensures that s3 bucket name won't overlap with the old CI's target
# Should be removed when the old CI is disabled
export BUILD_NUMBER=$BUILD_NUMBER"-ghactions"
go run mage.go -v ${{ matrix.platform }}
build-swagger:
runs-on: ubuntu-latest
needs: [build-packages]

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
- name: Generate Env
run: go run mage.go -v GenerateEnvFile
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build docker
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source build/env.sh
# Following line ensures that s3 bucket name won't overlap with the old CI's target
# Should be removed when the old CI is disabled
export BUILD_NUMBER=$BUILD_NUMBER"-ghactions"
go run mage.go -v PackageDockerSwaggerRedoc
132 changes: 132 additions & 0 deletions .github/workflows/mobile-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Mobile-release

on:
release:
types: [released]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Get Release
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Checkout tools repo
uses: actions/checkout@v4
with:
repository: mysteriumnetwork/mysterium-mobile-provider
ref: 'master'
path: mobile-app
token: ${{ secrets.REPO_TOKEN }}

- name: Update version
run: |
APP_VERSION=$(echo "$(grep "versionName" "./mobile-app/android/app/build.gradle.kts" | awk -F '"' '{print $2}')" + 0.1 | bc)
sed -i -E "/versionName\s*=\s*\"[0-9]+\.[0-9]+\"/s/\"[0-9]+\.[0-9]+\"/\"$APP_VERSION\"/" "./mobile-app/android/app/build.gradle.kts"
sed -i -E "/node\s*=\s*\"[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?\"/s/\"[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?\"/\"${{ env.RELEASE_VERSION }}\"/" "./mobile-app/android/gradle/libs.versions.toml"
- name: Pushes to another repository
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.REPO_TOKEN }}
with:
source-directory: mobile-app
destination-github-username: 'mysteriumnetwork'
destination-repository-name: 'mysterium-mobile-provider'
user-email: [email protected]
commit-message: Create release version ${{ env.RELEASE_VERSION }}
target-branch: master

- name: Send pull-request
env:
GH_TOKEN: ${{ secrets.REPO_TOKEN }}
run: |
LATEST_TAG=$(git describe --tags --always --abbrev=0)
REPOSITORY="mysteriumTeam/mysterium-mobile-provider"
FOLDER="bin/$REPOSITORY"
BRANCH_NAME="release-$LATEST_TAG"
# Clone the remote repository and change working directory to the
# folder it was cloned to.
git clone \
--depth=1 \
--branch=bitrise \
https://mpolubotko:${{ secrets.REPO_TOKEN }}@github.com/$REPOSITORY \
$FOLDER
cd $FOLDER
# Setup the committers identity.
git config user.email "[email protected]"
git config user.name "MysteriumTeam"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# Update the script files to the latest version.
cp -R ../../../mobile-app/android android
# Commit the changes and push the feature branch to origin
git add .
git commit -m "update files for new release version $LATEST_TAG"
git push origin $BRANCH_NAME
# Store the PAT in a file that can be accessed by the
# GitHub CLI.
echo "${{ secrets.REPO_TOKEN }}" > token.txt
# Authorize GitHub CLI for the current repository and
# create a pull-request containing the updates.
PR_URL=$(gh pr create \
--body "" \
--title "Release $LATEST_TAG" \
--head "$BRANCH_NAME" \
--base "master" \
| sed -n 's#https://github\.com/[^/]\+/[^/]\+/\pull/\([0-9]\+\).*#\1#p')
echo "PR_NUMBER=$PR_URL" >> $GITHUB_ENV
- name: Approve Pull Request
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
REPO_OWNER: "MysteriumTeam"
REPO_NAME: "mysterium-mobile-provider"
PR_NUMBER: ${{ env.PR_NUMBER }}
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" -L -X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER/merge \
-d '{"commit_title":"Release v${{ env.RELEASE_VERSION }}","commit_message":"${{ env.RELEASE_VERSION }}"}')
# Check HTTP response
if [ "$response" == "204" ] || [ "$response" == "200" ] || [ "$response" == "201" ]; then
echo "PR was approved successfully"
else
echo "Couldn't approved PR, HTTP-status: $response"
exit 1
fi
- name: "Call Bitrise API"
uses: indiesdev/[email protected]
with:
url: https://api.bitrise.io/v0.1/apps/${{ secrets.BITRISE_APP_ID }}/builds
method: "POST"
id: api
accept: 200, 201
headers: '{ "accept": "application/json", "Authorization": "${{ secrets.BITRISE_TOKEN }}", "Content-Type": "application/json" }'
body: '{ "hook_info": {"type": "bitrise"}, "build_params": {"branch":"master", "workflow_id":"build"}}'
timeout: 10000
log-response: true

- name: "Bitrise response"
run: echo ${{ steps.api.outputs.response }}
62 changes: 0 additions & 62 deletions .github/workflows/release.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Tests
on:
pull_request:

env:
GOFLAGS: "-count=1"

jobs:
unit-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'

- name: Install protoc
run: sudo apt install -y protobuf-compiler

- name: Unit tests and linters
run: |
go run mage.go -v Generate
go run mage.go -v Check
go run mage.go -v TestWithCoverage
- name: Upload codecov report
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}

e2e-tests:
runs-on: ubuntu-latest
needs: unit-tests

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: E2E basic test
run: go run mage.go -v TestE2EBasic

- name: E2E NAT test
run: go run mage.go -v TestE2ENAT

verify-build:
needs: [unit-tests, e2e-tests]
uses: ./.github/workflows/build-packages.yml
secrets: inherit
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Currently node supports WireGuard as its underlying VPN transport.
- [Latest release](https://github.com/mysteriumnetwork/node/releases/latest)
- [Snapshot builds](https://github.com/mysteriumnetwork/node-builds/releases) - bleeding edge, use at your own risk
- [Documentation](https://docs.mysterium.network/)
- [Installation guide](https://docs.mysterium.network/for-node-runners/linux-guide)
- [Help Center](https://help.mystnodes.com/)
- [Installation guide](https://help.mystnodes.com/en/?q=installation)

## Installation options

Expand Down Expand Up @@ -49,7 +50,7 @@ Installation script tested on these OSes so far: _Raspbian 10_, _Debian 9_, _Deb

Our docker images can be found in [Docker hub](https://hub.docker.com/r/mysteriumnetwork/myst).

To run a node in a docker container you will need [docker](https://www.docker.com/). On Linux, to manage docker as a non-root user (execute commands without `sudo`), follow [postinstall guide](https://docs.docker.com/install/linux/linux-postinstall/).
To run a node in a docker container you will need [docker](https://www.docker.com/). On Linux, to manage docker as a non-root user (execute commands without `sudo`), follow [postinstall guide](https://help.mystnodes.com/en/articles/3777670-running-a-node-as-docker-image-on-linux-host/).
You should be able to run a node on any OS that supports docker. We have tested it on these OSes so far:
- Debian 9
- Debian 10
Expand All @@ -74,8 +75,8 @@ docker logs -f myst

### Further information

More installation options are described in the [installation guide](https://docs.mysterium.network/for-node-runners/).
For possible issues while running a node refer to our [Troubleshooting guide](https://docs.mysterium.network/troubleshooting/).
More installation options are described in the [installation guides](https://help.mystnodes.com/en/?q=installation).
For possible issues while running a node refer to our [Troubleshooting guides](https://help.mystnodes.com/en/collections/1992526-troubleshooting-mystnodes-help-center).

## Built With

Expand Down
Loading

0 comments on commit b7a6fa1

Please sign in to comment.