CI-dev #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-dev | |
on: | |
push: | |
branches-ignore: | |
- master | |
pull_request: | |
workflow_dispatch: | |
env: | |
EARTHLY_USE_INLINE_CACHE: "true" | |
EARTHLY_SAVE_INLINE_CACHE: "true" | |
FORCE_COLOR: 1 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: earthly/actions-setup@v1 | |
with: | |
version: "v0.6.30" | |
- name: Login to DockerHub | |
if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name == 'push' | |
uses: docker/login-action@v1 | |
with: | |
username: haxeci | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build images | |
run: earthly +ci-images --GIT_REF_NAME="${{ github.ref_name }}" --GIT_SHA="${{ github.sha }}" | |
- name: Run tests | |
run: earthly --allow-privileged +ci-tests | |
- name: Push images | |
run: earthly --push +ci-images --GIT_REF_NAME="${{ github.ref_name }}" --GIT_SHA="${{ github.sha }}" | |
if: github.repository_owner == 'HaxeFoundation' && github.event_name == 'push' | |
deploy-development: | |
if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name == 'push' && github.ref_name == 'development' | |
needs: test | |
concurrency: deploy | |
runs-on: ubuntu-latest | |
container: haxe/haxelib_devcontainer_workspace:${{ github.sha }} | |
env: | |
AWS_DEFAULT_REGION: eu-west-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }} | |
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }} | |
TF_VAR_HAXELIB_DB_PASS: ${{ secrets.TF_VAR_HAXELIB_DB_PASS }} | |
TF_INPUT: 0 | |
TF_IN_AUTOMATION: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Verify image existence | |
run: docker manifest inspect haxe/lib.haxe.org:${{ github.sha }} | |
- name: Initialize Terraform | |
run: terraform init | |
working-directory: terraform | |
- name: Ensure no pending infra changes | |
run: terraform plan -refresh=false -detailed-exitcode | |
working-directory: terraform | |
- name: Set haxelib-server image | |
run: terraform apply -auto-approve -refresh=false | |
working-directory: terraform | |
env: | |
TF_VAR_HAXELIB_SERVER_IMAGE_DEVELOPMENT: haxe/lib.haxe.org:${{ github.sha }} |