Fix typo in STAC implementation #1922
Workflow file for this run
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: Unittest and docker builds | |
on: | |
push: | |
release: | |
types: [published] | |
env: | |
APP_NAME: xcube | |
ORG_NAME: bcdev | |
IMG_REG_NAME: quay.io | |
jobs: | |
unittest: | |
runs-on: ubuntu-latest | |
env: | |
NUMBA_DISABLE_JIT: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
# Setup miniconda build env | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: '1.4.8-0' | |
environment-file: environment.yml | |
init-shell: >- | |
bash | |
cache-environment: true | |
post-cleanup: 'all' | |
# Setup xcube | |
- name: setup-xcube | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
python setup.py develop | |
# Run unittests | |
- name: unittest-xcube | |
shell: bash -l {0} | |
run: | | |
pip install pytest pytest-cov | |
pytest --cov=./ --cov-report=xml | |
- uses: codecov/codecov-action@v1 | |
with: | |
verbose: true # optional (default = false) | |
build-docker-image: | |
runs-on: ubuntu-latest | |
# Build the docker image and push to quay.io | |
name: build-docker-image | |
# Only run if unittests succeed | |
needs: unittest | |
steps: | |
- name: git-checkout | |
uses: actions/checkout@v2 | |
# Determine release tag from git ref | |
- name: get-release-tag | |
id: release | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
# Print some info | |
- name: info | |
id: info | |
run: | | |
echo "TAG: ${{ steps.release.outputs.tag }}" | |
echo "EVENT: ${{ github.event_name }}" | |
# Build and push docker image 'latest' to quay.io when the event is a 'push' and branch 'master' | |
- uses: mr-smithers-excellent/docker-build-push@v5 | |
name: build-push-docker-image-latest | |
if: ${{ github.event_name == 'push' && steps.release.outputs.tag == 'master' }} | |
with: | |
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }} | |
tags: master, latest | |
registry: ${{ env.IMG_REG_NAME }} | |
username: ${{ secrets.IMG_REG_USERNAME }} | |
password: ${{ secrets.IMG_REG_PASSWORD }} | |
# Build and push docker release to quay.io when the event is a 'release' | |
- uses: mr-smithers-excellent/docker-build-push@v5 | |
name: build-push-docker-image-release | |
if: ${{ github.event_name == 'release' }} | |
with: | |
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }} | |
tags: ${{ steps.release.outputs.tag }} | |
registry: ${{ env.IMG_REG_NAME }} | |
username: ${{ secrets.IMG_REG_USERNAME }} | |
password: ${{ secrets.IMG_REG_PASSWORD }} | |
update-version: | |
runs-on: ubuntu-latest | |
needs: build-docker-image | |
name: update-xcube-tag | |
steps: | |
- name: Get installation token | |
id: get_installation_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.TOKEN_PROVIDER_APP_ID }} | |
private_key: ${{ secrets.TOKEN_PROVIDER_KEY }} | |
repository: bc-org/k8s-configs | |
# the installationId of the GitHub app we are using | |
installationId: 36950178 | |
- name: git-checkout | |
uses: actions/checkout@v2 | |
- name: checkout-k8s | |
run: | | |
git clone https://x-access-token:${{ steps.get_installation_token.outputs.token }}@github.com/bc-org/k8s-configs.git | |
mv k8s-configs k8s | |
- name: get-release-tag | |
id: release | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: deployment-phase | |
id: deployment-phase | |
uses: bc-org/gha-determine-phase@v0.1 | |
with: | |
event_name: ${{ github.event_name }} | |
tag: ${{ steps.release.outputs.tag }} | |
- name: get-hash | |
id: get-hash | |
run: | | |
HASH=$(skopeo inspect docker://${{ env.IMG_REG_NAME }}/${{ env.ORG_NAME }}/${{ env.APP_NAME }}:${{ steps.release.outputs.tag }} | jq '.Digest') | |
if [[ "$HASH" == *"sha256"* ]]; then | |
echo ::set-output name=hash::$HASH | |
else | |
echo "No hash present. Using none as hash. This will use the version tag instead for deployment." | |
echo ::set-output name=hash::none | |
fi | |
- name: info | |
run: | | |
echo "Event: ${{ github.event_name }}" | |
echo "Deployment Stage: ${{ steps.deployment-phase.outputs.phase }}" | |
echo "Release Tag: ${{ steps.release.outputs.tag }}" | |
echo "Deployment Release Tag: ${{ steps.deployment-phase.outputs.tag }}" | |
echo "Deployment Digest: ${{ steps.get-hash.outputs.hash }}" | |
- name: set-version-tag-xcube-gen | |
uses: bc-org/update-application-version-tags@main | |
with: | |
app: ${{ env.APP_NAME }} | |
phase: ${{ steps.deployment-phase.outputs.phase }} | |
delimiter: ' ' | |
tag: ${{ steps.deployment-phase.outputs.tag }} | |
hash: ${{ steps.get-hash.outputs.hash }} | |
working-directory: ./k8s/xcube-gen/helm | |
- name: cat-result | |
working-directory: ./k8s/xcube-gen/helm | |
run: | | |
head values-dev.yaml | |
head values-stage.yaml | |
head values-prod.yaml | |
- name: Pushes to another repository | |
# Don't run if run locally and should be ignored | |
if: ${{ steps.deployment-phase.outputs.phase != 'ignore' && !env.ACT }} | |
run: | | |
cd ./k8s | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git commit -am "${{ github.event.release }}. Set version to ${{ steps.release.outputs.tag }}." | |
git remote set-url origin https://x-access-token:${{ steps.get_installation_token.outputs.token }}@github.com/bc-org/k8s-configs.git | |
git push origin main |