Skip to content

Commit

Permalink
Merge pull request #5974 from mysteriumnetwork/ci-migration
Browse files Browse the repository at this point in the history
CI migration to Github Actions, part 2
  • Loading branch information
tzununbekov authored Feb 19, 2024
2 parents 516e27e + db11f14 commit c29b292
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 12 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build packages
# Start build process only on E2E completion
# Big chunk of the build process logic is in the mage build targets
on:
workflow_run:
workflows: [E2E tests]
types: [completed]

# 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:
if: |
${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: production

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:
if: |
${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: production
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
33 changes: 33 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: E2E tests
# Run E2E tests after Unit tests (currently, they run on PRs)
on:
workflow_run:
workflows: [Unit tests and linters]
types: [completed]

jobs:
e2e-tests:
# Parent workflow (unit tests) must succeed
if: |
${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: production

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
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Test and build
on: [pull_request]
name: Unit tests and linters
# Run unit tests on all pull requests
on:
pull_request:

env:
GOFLAGS: "-count=1"

jobs:
test-and-build:
unit-tests:
runs-on: ubuntu-latest
environment: production

Expand All @@ -31,14 +33,5 @@ jobs:
file: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}

- 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

0 comments on commit c29b292

Please sign in to comment.