diff --git a/.github/workflows/build-test-release-tagged.yaml b/.github/workflows/build-test-release-tagged.yaml new file mode 100644 index 00000000..801eab7a --- /dev/null +++ b/.github/workflows/build-test-release-tagged.yaml @@ -0,0 +1,30 @@ +name: build-test-release-tagged + +on: + push: + tags: + - v* + +jobs: + build-test-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build all targets. + run: | + make build-all + - name: Run unit tests across all targets. + run: | + make test-all + - name: Prepare scenarios to be released. + run: | + sudo apt install zip + zip -r scenarios.zip scenarios + - name: Release Innovation Engine + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + generate_release_notes: true + files: | + ./bin/ie + ./scenarios.zip diff --git a/.github/workflows/scenario-testing.yaml b/.github/workflows/scenario-testing.yaml index d2d095eb..023608ea 100644 --- a/.github/workflows/scenario-testing.yaml +++ b/.github/workflows/scenario-testing.yaml @@ -13,6 +13,22 @@ permissions: id-token: write contents: read jobs: + test-ie-installation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check ie installation + run: | + cat scripts/install_from_release.sh | /bin/bash + if ! command -v ie; then + echo "ie not found" + exit 1 + fi + if [ ! -d "${HOME}/scenarios" ] + then + echo "scenarios not found" + exit 1 + fi test-ocd-scenarios: runs-on: ubuntu-latest # This is needed in order to obtain OIDC tokens to sign this pipeline into diff --git a/scripts/install_from_release.sh b/scripts/install_from_release.sh index cf261837..ce837524 100644 --- a/scripts/install_from_release.sh +++ b/scripts/install_from_release.sh @@ -1,14 +1,19 @@ # Script to install scenarios file. Pass in language code parameter for a particular language, such as it-it for Italian. set -e -# Define the language parameter +# TODO: make parameters mandatory LANG="$1" -SCENARIOS="" +RELEASE="$2" + +# If no release is specified, download the latest release +if [ "$RELEASE" == "" ]; then + RELEASE="latest" +fi # Map the language parameter to the corresponding scenarios file # If no parameter, download the scenarios from IE if [ "$LANG" = "" ]; then - SCENARIOS='https://github.com/Azure/InnovationEngine/releases/download/latest/scenarios.zip' + SCENARIOS="https://github.com/Azure/InnovationEngine/releases/download/$RELEASE/scenarios.zip" # Otherwise, download the scenarios from Microsoft Docs in the appropriate langauge elif [ "$LANG" = "en-us" ]; then SCENARIOS='https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/scenarios.zip' @@ -16,9 +21,9 @@ else SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$LANG-scenarios.zip" fi -# Download the binary from the latest -echo "Installing IE & scenarios from the latest release..." -wget -q -O ie https://github.com/Azure/InnovationEngine/releases/download/latest/ie > /dev/null +# Download the binary +echo "Installing IE & scenarios from the $RELEASE release..." +wget -q -O ie https://github.com/Azure/InnovationEngine/releases/download/$RELEASE/ie > /dev/null wget -q -O scenarios.zip "$SCENARIOS" > /dev/null # Setup permissions & move to the local bin