1818 runs-on : ubuntu-latest
1919
2020 steps :
21+
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+
2125 - uses : aws-actions/configure-aws-credentials@v4
2226 name : configure aws credentials
2327 with :
6973 - name : Launch EC2 Instance
7074 id : ec2
7175 run : |
72- AMI_ID=ami-0fe972392d04329e1
76+ AMI_ID=ami-0ff5662328e9bbc2f
7377 INSTANCE_ID=$(aws ec2 run-instances \
7478 --image-id "$AMI_ID" \
7579 --count 1 \
@@ -96,53 +100,17 @@ jobs:
96100 echo "DNS=$DNS" >> $GITHUB_ENV
97101 echo "dns=$DNS" >> $GITHUB_OUTPUT
98102
99- - name : Install dependencies
100- run : |
101- echo "Current branch: $BRANCH_NAME"
102- ssh -o StrictHostKeyChecking=no -i key.pem ec2-user@$DNS << EOF
103- set -e
104- sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon
105- source ~/.bashrc
106- mkdir -p ~/.config/nix
107- echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
108- sudo yum update
109- sudo yum install git -y
110- sudo yum install docker -y
111- sudo amazon-linux-extras install aws-nitro-enclaves-cli -y
112- git clone https://github.com/EspressoSystems/optimism-espresso-integration.git
113- cd optimism-espresso-integration
114- git checkout "$BRANCH_NAME"
115- git submodule update --init --recursive
116- nix develop
117- EOF
118-
119- - name : Configure and start enclave service
103+ - name : Upload run-tests.sh to EC2
120104 run : |
121- ssh -o StrictHostKeyChecking=no -i key.pem ec2-user@$DNS << 'EOF'
122- set -e
123- sudo nitro-cli --version
124- sudo systemctl stop nitro-enclaves-allocator.service
125- echo -e '---\nmemory_mib: 4096\ncpu_count: 2' | sudo tee /etc/nitro_enclaves/allocator.yaml
126- sudo systemctl start nitro-enclaves-allocator.service
127- EOF
128-
129- - name : Start docker service
130- run : |
131- ssh -o StrictHostKeyChecking=no -i key.pem ec2-user@$DNS << 'EOF'
132- set -e
133- sudo usermod -a -G docker ec2-user
134- sudo service docker start
135- sudo chown ec2-user /var/run/docker.sock
136- EOF
105+ scp -o StrictHostKeyChecking=no -i key.pem espresso/scripts/run-tests-github-actions.sh ec2-user@$DNS:/home/ec2-user/
106+ ssh -o StrictHostKeyChecking=no -i key.pem ec2-user@$DNS "chmod +x run-tests-github-actions.sh"
137107
138- # Compile contracts first to avoid text file busy error
139- - name : Run tests
108+ - name : Run test script on EC2
109+ timeout-minutes : 40
140110 run : |
141- ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5 -i key.pem ec2-user@$DNS << 'EOF'
142- set -e
143- cd /home/ec2-user/optimism-espresso-integration
144- nix develop --command just compile-contracts
145- nix develop --command just espresso-enclave-tests
111+ ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5 -i key.pem ec2-user@$DNS << EOF
112+ export BRANCH_NAME=$BRANCH_NAME
113+ ./run-tests-github-actions.sh ${{ secrets.CACHIX_AUTH_TOKEN }}
146114 EOF
147115
148116 - name : Terminate EC2 instance
0 commit comments