Skip to content

Remove CodeMagic and M1 support #166

Remove CodeMagic and M1 support

Remove CodeMagic and M1 support #166

name: "GitHub Runner Provisioner: Tests, Builds, Deployments"
on:
pull_request:
paths:
- .github/workflows/github-runner-provisioner.yaml
- github-runner-provisioner/**
- '!**/*.md'
push:
branches:
- '**'
paths-ignore:
- '**/*.md'
jobs:
go_test:
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: FAKE_TOKEN
WEBHOOK_TOKEN: FAKE_TOKEN
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: |
cd github-runner-provisioner
make go-unit-tests
mock_traffic_test:
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GRP_GITHUB_TOKEN }}
WEBHOOK_TOKEN: FAKE_TOKEN
AWS_ACCESS_KEY_ID: ${{ secrets.GRP_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GRP_AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: cd github-runner-provisioner
- name: Build for Test
uses: docker/build-push-action@v5
with:
file: "github-runner-provisioner/Dockerfile"
platforms: linux/amd64
push: false
tags: |
datawiredev/github-runner-provisioner:${{ github.sha }}
outputs: type=docker, dest=/tmp/github-runner-provisioner.tar
cache-from: |
type=gha,scope=refs/heads/main
type=gha,scope=github-runner-provisioner-${{github.ref}}
cache-to: type=gha,mode=max,scope=github-runner-provisioner-${{github.ref}}
- name: Test AWS
run: |
cd github-runner-provisioner
docker load --input /tmp/github-runner-provisioner.tar
docker run -d --name=github-runner-provisioner-aws -p 8080:8080 \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
-e WEBHOOK_TOKEN=${WEBHOOK_TOKEN} \
-e AWS_REGION="us-east-1" \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
datawiredev/github-runner-provisioner:${{ github.sha }}
make test-runners
docker stop github-runner-provisioner-aws
echo
echo "Container logs:"
docker logs github-runner-provisioner-aws
echo
if [ $(cat /tmp/test-ubuntu-arm64) != "200" ]; then
echo "Test failed"
exit 1
fi
echo "Test Successful"
build:
runs-on: ubuntu-22.04
needs: [go_test, mock_traffic_test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: cd github-runner-provisioner
- name: Build and push
uses: docker/build-push-action@v5
with:
file: "github-runner-provisioner/Dockerfile"
platforms: linux/amd64
push: true
tags: |
datawiredev/github-runner-provisioner:${{ github.sha }}
cache-from: |
type=gha,scope=refs/heads/main
type=gha,scope=github-runner-provisioner-${{github.ref}}
cache-to: type=gha,mode=max,scope=github-runner-provisioner-${{github.ref}}
deploy:
runs-on: ubuntu-22.04
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GRP_GITHUB_TOKEN }}
- name: Update Kustomize
env:
INFRA_ACTIONS_SHA: ${{ github.sha }}
run: |
cd github-runner-provisioner
envsubst < kustomization.yaml.in > kustomization.yaml
git config user.email "[email protected]"
git config user.name "d6e-automaton"
git add -A
git status
cat kustomization.yaml
echo "Updating manifests with image version ${INFRA_ACTIONS_SHA} and pushing to branch ${branch}"
git commit -m "Deploying updated manifest to ${INFRA_ACTIONS_SHA} [skip ci]"
git push --set-upstream origin ${branch}