Alloy Prod #118
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: Alloy Prod | |
on: | |
schedule: | |
- cron: "45 20 * * 1-6" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
issues: read | |
packages: none | |
env: | |
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
SAUCE_CAPABILITIES_OVERRIDES_PATH: "sauceLabsCapabilities.json" | |
SAUCE_JOB: "Alloy Prod Workflow" | |
ALLOY_ENV: prod | |
jobs: | |
get-testing-tags: | |
name: Fetch releases | |
runs-on: ubuntu-latest | |
outputs: | |
matrixInput: ${{ steps.list-tags.outputs.matrixInput }} | |
steps: | |
- uses: actions/labeler@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
env: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm install @octokit/rest semver | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sauce-config | |
path: .sauce | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sauce-ignore | |
path: .sauceignore | |
- name: Retrieve tags | |
id: list-tags | |
uses: actions/github-script@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
script: | | |
const getTestingTags = require('./scripts/getTestingTags.js'); | |
const tagsToTest = await getTestingTags(); | |
const matrixInput = { include: tagsToTest.map(tag => ({tag})) } | |
core.setOutput("matrixInput", JSON.stringify(matrixInput)); | |
console.log("matrixInput: ", matrixInput); | |
alloy-prod-e2e: | |
name: Alloy Functional Test | |
strategy: | |
max-parallel: 14 | |
matrix: ${{ fromJSON(needs.get-testing-tags.outputs.matrixInput) }} | |
needs: get-testing-tags | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Create a workflow dispatch event with ${{ matrix.tag }} | |
uses: actions/checkout@v3 | |
with: | |
ref: refs/heads/${{ matrix.tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clear cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }} # increment NPM_CACHE_VERSION secret to force cache reset | |
- name: Store Alloy version into env | |
uses: nyaa8/package-version@v1 | |
- name: Download sauce config into tags | |
uses: actions/download-artifact@v3 | |
with: | |
name: sauce-config | |
path: .sauce | |
- name: Remove File | |
uses: JesseTG/[email protected] | |
with: | |
path: .sauceignore | |
- uses: actions/download-artifact@v3 | |
with: | |
name: sauce-ignore | |
path: . | |
- name: NPM Install | |
run: npm install | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Build | |
run: npm run test:functional:build:prod | |
env: | |
ALLOY_PROD_VERSION: ${{ env.PACKAGE_VERSION }} | |
- name: Chrome Functional Test | |
uses: saucelabs/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
sauce-username: ${{ secrets.SAUCE_USERNAME }} | |
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | |
env: | | |
SAUCE_USERNAME=${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY=${{ secrets.SAUCE_ACCESS_KEY }} | |
ALLOY_PROD_VERSION=${{ env.PACKAGE_VERSION }} | |
NPM_PACKAGE_VERSION=${{ env.PACKAGE_VERSION }} | |
ALLOY_ENV=prod | |
config-file: ./.sauce/prod.yml | |
select-suite: "Chrome" | |
- name: Edge Functional Test | |
uses: saucelabs/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
sauce-username: ${{ secrets.SAUCE_USERNAME }} | |
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | |
env: | | |
SAUCE_USERNAME=${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY=${{ secrets.SAUCE_ACCESS_KEY }} | |
ALLOY_PROD_VERSION=${{ env.PACKAGE_VERSION }} | |
NPM_PACKAGE_VERSION=${{ env.PACKAGE_VERSION }} | |
ALLOY_ENV=prod | |
config-file: ./.sauce/prod.yml | |
select-suite: "Edge" | |
- name: Firefox Functional Test | |
uses: saucelabs/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
sauce-username: ${{ secrets.SAUCE_USERNAME }} | |
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | |
env: | | |
SAUCE_USERNAME=${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY=${{ secrets.SAUCE_ACCESS_KEY }} | |
ALLOY_PROD_VERSION=${{ env.PACKAGE_VERSION }} | |
NPM_PACKAGE_VERSION=${{ env.PACKAGE_VERSION }} | |
ALLOY_ENV=prod | |
config-file: ./.sauce/prod.yml | |
select-suite: "Firefox" | |
- name: Safari Functional Test | |
uses: saucelabs/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
sauce-username: ${{ secrets.SAUCE_USERNAME }} | |
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | |
env: | | |
SAUCE_USERNAME=${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY=${{ secrets.SAUCE_ACCESS_KEY }} | |
ALLOY_PROD_VERSION=${{ env.PACKAGE_VERSION }} | |
NPM_PACKAGE_VERSION=${{ env.PACKAGE_VERSION }} | |
ALLOY_ENV=prod | |
config-file: ./.sauce/prod.yml | |
select-suite: "Safari" | |
- uses: craftech-io/slack-action@v1 | |
with: | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
status: failure | |
if: failure() |