Merge pull request #68 from Dhruvnotfound/main #194
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: 'Test' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
jobs: | |
# Only checking latest Linux/UNIX on pulls to save execution times | |
test-main-pulls: | |
if: github.event_name == 'pull_request' | |
runs-on: "${{ matrix.os }}" | |
strategy: | |
matrix: | |
os: | |
- 'macos-latest' | |
- 'ubuntu-latest' | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 1 | |
- name: 'Install Dependencies' | |
run: './test/install_deps.sh' | |
- name: 'Run all tests' | |
run: 'TOFUENV_GITHUB_TOKEN=${{ secrets.TOFUENV_GITHUB_TOKEN }} ./test/run.sh' | |
shell: 'bash' | |
- name: 'Set up Docker Buildx' | |
uses: 'docker/setup-buildx-action@v3' | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
install: true | |
- name: 'Login to Docker Hub' | |
uses: docker/login-action@v3 | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: 'Build docker image and push it' | |
uses: 'docker/build-push-action@v6' | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
context: . | |
load: true | |
tags: | | |
tofuutils/tofuenv:${{ github.sha }} | |
- name: 'Check Dockerfile' | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
expect=1.6.0-rc1; | |
got="$(docker run -e "TOFUENV_TOFU_VERSION=${expect}" "tofuutils/tofuenv:${{ github.sha }}" version)"; | |
echo "${got}" | tee /dev/stderr | grep -e 'OpenTofu v1.6.0-rc1' | |
# When we push to main, test everything in order to guarantee releases | |
test-main-pushes: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: "${{ matrix.os }}" | |
strategy: | |
matrix: | |
os: | |
- 'macos-11' | |
- 'macos-12' | |
- 'macos-13' | |
- 'ubuntu-20.04' | |
- 'ubuntu-22.04' | |
- 'windows-2019' | |
- 'windows-2022' | |
steps: | |
- uses: 'actions/checkout@v4' | |
with: | |
fetch-depth: 1 | |
- name: 'Install Dependencies' | |
run: './test/install_deps.sh' | |
- name: 'Run all tests' | |
run: 'TOFUENV_GITHUB_TOKEN=${{ secrets.TOFUENV_GITHUB_TOKEN }} ./test/run.sh' | |
shell: 'bash' | |
- name: 'Set up Docker Buildx' | |
uses: 'docker/setup-buildx-action@v3' | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
install: true | |
- name: 'Login to Docker Hub' | |
uses: docker/login-action@v3 | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: 'Build docker image and push it' | |
uses: 'docker/build-push-action@v6' | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
context: . | |
load: true | |
tags: | | |
tofuutils/tofuenv:latest | |
- name: 'Check Dockerfile' | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
expect=1.6.0-rc1; | |
got="$(docker run -e "TOFUENV_TOFU_VERSION=${expect}" tofuutils/tofuenv:latest version)"; | |
echo "${got}" | tee /dev/stderr | grep -e 'OpenTofu v1.6.0-rc1' |